From: Kenji Okimoto <okimoto@clear-code.com>
To: linux-btrfs@vger.kernel.org
Cc: Kenji Okimoto <okimoto@clear-code.com>
Subject: [PATCH 3/3] btrfs-progs: plug memory leaks in btrfs_scan_one_dir() reported by cppcheck.
Date: Thu, 15 Nov 2012 13:47:52 +0900 [thread overview]
Message-ID: <1352954872-13770-4-git-send-email-okimoto@clear-code.com> (raw)
In-Reply-To: <1352954872-13770-1-git-send-email-okimoto@clear-code.com>
[utils.c:983]: (error) Memory leak: fullpath
Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
---
utils.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/utils.c b/utils.c
index 205e667..3efb3af 100644
--- a/utils.c
+++ b/utils.c
@@ -980,6 +980,7 @@ again:
dirp = opendir(dirname);
if (!dirp) {
fprintf(stderr, "Unable to open %s for scanning\n", dirname);
+ free(fullpath);
return -ENOENT;
}
while(1) {
@@ -1030,6 +1031,7 @@ again:
free(pending);
pending = list_entry(pending_list.next, struct pending_dir,
list);
+ free(fullpath);
list_del(&pending->list);
closedir(dirp);
dirp = NULL;
@@ -1038,6 +1040,7 @@ again:
ret = 0;
fail:
free(pending);
+ free(fullpath);
if (dirp)
closedir(dirp);
return ret;
--
1.7.10.4
prev parent reply other threads:[~2012-11-15 4:58 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-15 4:47 [PATCH 0/3] btrfs-progs: fix problems reported by cppcheck Kenji Okimoto
2012-11-15 4:47 ` [PATCH 1/3] btrfs-progs: plug a memory leak " Kenji Okimoto
2012-11-15 4:47 ` [PATCH 2/3] btrfs-progs: check malloc() result Kenji Okimoto
2012-11-15 4:47 ` Kenji Okimoto [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1352954872-13770-4-git-send-email-okimoto@clear-code.com \
--to=okimoto@clear-code.com \
--cc=linux-btrfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.