fn and/or array was not freed in some error paths.
[ Also make sure the array is NULL terminated before we free it in
get_dirlist(). --tytso]
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
new_array = realloc(array, sizeof(char *) * (max+1));
if (!new_array) {
retval = ENOMEM;
+ free(fn);
goto errout;
}
array = new_array;
closedir(dir);
return 0;
errout:
+ if (array)
+ array[num] = 0;
closedir(dir);
free_list(array);
return retval;
* If all the files were not found, return the appropriate error.
*/
if (!profile->first_file) {
- profile_release(profile);
- return ENOENT;
+ retval = ENOENT;
+ goto errout;
}
}