Fix a mistake excluding NULL in the end

This commit is contained in:
Takashi Kokubun 2019-12-01 02:00:08 -08:00
parent 8a677a6e80
commit 91af5542b5
No known key found for this signature in database
GPG Key ID: 6FFC433B12EE23DD
1 changed files with 2 additions and 2 deletions

4
mjit.c
View File

@ -730,10 +730,10 @@ split_flags(char *flags)
next++; // skip space
}
}
buf[i] = NULL;
char **ret = xmalloc(sizeof(char **) * i);
char **ret = xmalloc(sizeof(char **) * (i + 1));
memcpy((void *)ret, buf, sizeof(char **) * i);
ret[i] = NULL;
return ret;
}