summaryrefslogtreecommitdiff
path: root/utils.c
diff options
context:
space:
mode:
authorKenji Okimoto <okimoto@clear-code.com>2012-11-15 13:47:52 +0900
committerDavid Sterba <dsterba@suse.cz>2013-01-17 18:27:55 +0100
commit6e0e6c5e63ca2f9862d0116b09185abdad8ccacf (patch)
treec74c56cc25210b90532496d020bff0296401a9e2 /utils.c
parent1cce8d72f2d0d00bd5c9322b16176de0fb56aff6 (diff)
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>
Diffstat (limited to 'utils.c')
-rw-r--r--utils.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/utils.c b/utils.c
index b487be61..938f9a53 100644
--- a/utils.c
+++ b/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;