From c470cbfc85ffba5f0fae7a74d27553fd623a9844 Mon Sep 17 00:00:00 2001 From: Namhyung Kim Date: Thu, 26 Sep 2013 00:32:04 +0900 Subject: libmount: Free splitted optstr's when error occurred When strdup() failed, u, v and f optstr's should be freed. Signed-off-by: Namhyung Kim --- libmount/src/fs.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libmount/src/fs.c') diff --git a/libmount/src/fs.c b/libmount/src/fs.c index 23c873d54..ebdc44fb9 100644 --- a/libmount/src/fs.c +++ b/libmount/src/fs.c @@ -831,8 +831,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); -- cgit v1.2.3-55-g7522