Commit 70dbeab7 authored by Dustin L. Howett's avatar Dustin L. Howett

We get a free NULL if we use calloc, so do that instead of checking msgbuf.

parent 92899600
...@@ -58,7 +58,7 @@ _EVENT(PRIVMSG) { ...@@ -58,7 +58,7 @@ _EVENT(PRIVMSG) {
char *commandname = strsep(&msgbuf, " "); char *commandname = strsep(&msgbuf, " ");
int argc = 0; int argc = 0;
int nargmax = 1; int nargmax = 1;
char **argv = (char**)malloc(nargmax * sizeof(char*)); char **argv = (char**)calloc(nargmax, sizeof(char*));
if(msgbuf) { if(msgbuf) {
int argstart = 0; int argstart = 0;
for(unsigned int i = 0; i <= strlen(msgbuf); ++i) { for(unsigned int i = 0; i <= strlen(msgbuf); ++i) {
...@@ -77,8 +77,6 @@ _EVENT(PRIVMSG) { ...@@ -77,8 +77,6 @@ _EVENT(PRIVMSG) {
} }
} }
argv[argc] = NULL; argv[argc] = NULL;
} else {
*argv = NULL;
} }
struct command_state state; struct command_state state;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment