: Add check for realloc failure case
Hi!
Review const char **splitstr(const char *str, const char *separator, int *argcount) · line 119
Quoted 7 lines
(quoted diff) +3
-0@@ -113,6 +114,12 @@ const char **splitstr(const char *str, const char *separator, int *argcount) arg_array = (char **)realloc((void *)arg_array, sizeof(char *) * max_toks); + if (arg_array == NULL) { + fprintf(stderr, "realloc: New memory allocation failed \n"); + free(arg_array);
I've removed the free(arg_array) here, because it's noop (doing free(NULL)) and pushed both patches.
Signature · 8 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list