From: Thomas Jarosch <thomas.jarosch@intra2net.com>
To: linux-raid@vger.kernel.org
Cc: Neil Brown <neilb@suse.de>
Subject: [mdadm PATCH] Fix small memory leak
Date: Sun, 02 Oct 2011 21:45:41 +0200 [thread overview]
Message-ID: <4E88BF65.2010500@intra2net.com> (raw)
Credit goes to cppcheck.
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
policy.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/policy.c b/policy.c
index 2bbbac8..4a6ef82 100644
--- a/policy.c
+++ b/policy.c
@@ -757,8 +757,10 @@ int policy_check_path(struct mdinfo *disk, struct map_ent *array)
snprintf(path, PATH_MAX, FAILED_SLOTS_DIR "/%s", id_path);
f = fopen(path, "r");
- if (!f)
+ if (!f) {
+ free(id_path);
return 0;
+ }
rv = fscanf(f, " %s %x:%x:%x:%x\n",
array->metadata,
@@ -767,6 +769,7 @@ int policy_check_path(struct mdinfo *disk, struct map_ent *array)
array->uuid+2,
array->uuid+3);
fclose(f);
+ free(id_path);
return rv == 5;
}
--
1.7.4.4
next reply other threads:[~2011-10-02 19:45 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-02 19:45 Thomas Jarosch [this message]
2011-10-02 21:31 ` [mdadm PATCH] Fix small memory leak NeilBrown
-- strict thread matches above, loose matches on Subject: below --
2011-08-26 5:33 Thomas Jarosch
2011-09-07 8:11 ` NeilBrown
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=4E88BF65.2010500@intra2net.com \
--to=thomas.jarosch@intra2net.com \
--cc=linux-raid@vger.kernel.org \
--cc=neilb@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).