static int create_argv_offset(int offset, const char *buf, const char *delim,
char ***result)
{
- char *word, **argv = arr_alloc(offset + 1, sizeof(char *));
+ char *word, **argv = arr_zalloc(offset + 1, sizeof(char *));
const char *p;
int i, ret;
- for (i = 0; i < offset; i++)
- argv[i] = NULL;
- for (p = buf; p && *p; p += ret, i++) {
+ for (p = buf, i = offset; p && *p; p += ret, i++) {
ret = get_next_word(p, delim, &word);
if (ret < 0)
goto err;