]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Btrfs: fix memory leak in btrfs_parse_early_options()
authorIlya Dryomov <idryomov@gmail.com>
Tue, 8 Nov 2011 14:47:55 +0000 (16:47 +0200)
committerChris Mason <chris.mason@oracle.com>
Wed, 16 Nov 2011 02:20:56 +0000 (21:20 -0500)
Don't leak subvol_name string in case multiple subvol= options are
given.  "The lastest option is effective" behavior (consistent with
subvolid= and subvolrootid= options) is preserved.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit a90e8b6fb80db43b029e1e76205452afa8bdc77a)

fs/btrfs/super.c

index 17acb686d1cffe496454b6d883c8b68152c3ae17..519e674ec488f4b685bdff4570a56be372bb782b 100644 (file)
@@ -448,6 +448,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
                token = match_token(p, tokens, args);
                switch (token) {
                case Opt_subvol:
+                       kfree(*subvol_name);
                        *subvol_name = match_strdup(&args[0]);
                        break;
                case Opt_subvolid: