From 6e0e6c5e63ca2f9862d0116b09185abdad8ccacf Mon Sep 17 00:00:00 2001 From: Kenji Okimoto Date: Thu, 15 Nov 2012 13:47:52 +0900 Subject: [PATCH] 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 --- utils.c | 3 +++ 1 file changed, 3 insertions(+) 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;