mirror of
https://github.com/kdave/btrfs-progs
synced 2024-12-23 22:53:35 +00:00
btrfs-progs: plug memory leaks in btrfs_scan_one_dir() reported by cppcheck.
[utils.c:983]: (error) Memory leak: fullpath Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
This commit is contained in:
parent
1cce8d72f2
commit
6e0e6c5e63
3
utils.c
3
utils.c
@ -981,6 +981,7 @@ again:
|
||||
dirp = opendir(dirname);
|
||||
if (!dirp) {
|
||||
fprintf(stderr, "Unable to open %s for scanning\n", dirname);
|
||||
free(fullpath);
|
||||
return -ENOENT;
|
||||
}
|
||||
while(1) {
|
||||
@ -1031,6 +1032,7 @@ again:
|
||||
free(pending);
|
||||
pending = list_entry(pending_list.next, struct pending_dir,
|
||||
list);
|
||||
free(fullpath);
|
||||
list_del(&pending->list);
|
||||
closedir(dirp);
|
||||
dirp = NULL;
|
||||
@ -1039,6 +1041,7 @@ again:
|
||||
ret = 0;
|
||||
fail:
|
||||
free(pending);
|
||||
free(fullpath);
|
||||
if (dirp)
|
||||
closedir(dirp);
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user