From: Namhyung Kim <namhyung@gmail.com>
To: util-linux@vger.kernel.org
Subject: [PATCH 2/4] libmount: Free splitted optstr's when error occurred
Date: Thu, 26 Sep 2013 00:32:04 +0900 [thread overview]
Message-ID: <1380123126-3030-2-git-send-email-namhyung@gmail.com> (raw)
In-Reply-To: <1380123126-3030-1-git-send-email-namhyung@gmail.com>
When strdup() failed, u, v and f optstr's should be freed.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
libmount/src/fs.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/libmount/src/fs.c b/libmount/src/fs.c
index c95cdc7..e3a2e1a 100644
--- a/libmount/src/fs.c
+++ b/libmount/src/fs.c
@@ -774,8 +774,12 @@ int mnt_fs_set_options(struct libmnt_fs *fs, const char *optstr)
if (rc)
return rc;
n = strdup(optstr);
- if (!n)
+ if (!n) {
+ free(u);
+ free(v);
+ free(f);
return -ENOMEM;
+ }
}
free(fs->fs_optstr);
--
1.7.9.2
next prev parent reply other threads:[~2013-09-25 15:32 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-25 15:32 [PATCH 1/4] libmount: Get rid of an unnecessary check Namhyung Kim
2013-09-25 15:32 ` Namhyung Kim [this message]
2013-09-26 7:50 ` [PATCH 2/4] libmount: Free splitted optstr's when error occurred Karel Zak
2013-09-25 15:32 ` [PATCH 3/4] libmount: Set each optstr's to NULL if failed Namhyung Kim
2013-09-26 7:53 ` Karel Zak
2013-09-25 15:32 ` [PATCH 4/4] libmount: Remove stale comment on mnt_context_mount() Namhyung Kim
2013-09-26 7:53 ` Karel Zak
2013-09-26 7:49 ` [PATCH 1/4] libmount: Get rid of an unnecessary check Karel Zak
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=1380123126-3030-2-git-send-email-namhyung@gmail.com \
--to=namhyung@gmail.com \
--cc=util-linux@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox