add malloc check to fix
parent
b561f60702
commit
8996f5494f
|
@ -206,13 +206,13 @@ void parse_dirpath(char *dirpath_arg) {
|
||||||
}
|
}
|
||||||
tmp++;
|
tmp++;
|
||||||
}
|
}
|
||||||
|
// prevent changes to the original dirpath_arg
|
||||||
|
dirpath_arg = strdup(dirpath_arg);
|
||||||
filenames = (char **)malloc(path_count * sizeof(char **));
|
filenames = (char **)malloc(path_count * sizeof(char **));
|
||||||
if (filenames == NULL) {
|
if (filenames == NULL || dirpath_arg == NULL) {
|
||||||
FAIL("out of memory");
|
FAIL("out of memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
// prevent changes to the original dirpath_arg
|
|
||||||
dirpath_arg = strdup(dirpath_arg);
|
|
||||||
token = strtok(dirpath_arg, delimiter_string);
|
token = strtok(dirpath_arg, delimiter_string);
|
||||||
while (token != NULL) {
|
while (token != NULL) {
|
||||||
filenames[i] = token;
|
filenames[i] = token;
|
||||||
|
|
Loading…
Reference in New Issue