roken: Fix warnings

This commit is contained in:
Nicolas Williams
2021-03-27 22:19:54 -05:00
parent 3a7c2c6a7f
commit a90e1cb65c
9 changed files with 69 additions and 35 deletions

View File

@@ -440,16 +440,18 @@ rk_strrasvisx(char **out,
return -1;
}
if (have < want) {
if ((s = realloc(*out, want)) == NULL)
if ((s = realloc(s, want)) == NULL)
return -1;
*outsz = want;
*out = s;
}
if (*out == NULL) {
errno = EINVAL;
return -1;
}
**out = '\0'; /* Makes source debugging nicer, that's all */
if ((r = strsvisx(*out, csrc, len, flag, extra)) < 0)
return r;
errno = *out ? errno : EINVAL;
return *out ? r : -1;
r = strsvisx(*out, csrc, len, flag, extra);
return r;
}
#if !HAVE_VIS
@@ -641,6 +643,7 @@ main(int argc, char **argv)
}
free(nextra);
free(s);
return 0;
}
#endif