Thread (6 messages) 6 messages, 3 authors, 2011-09-15

Re: [PATCH] btrfs: trivial fix, a potential memory leak in btrfs_parse_early_options()

From: Li Zefan <hidden>
Date: 2011-09-14 05:40:29

14:06, Jeff Liu wrote:
quoted hunk ↗ jump to hunk
Signed-off-by: Jie Liu <redacted>

---
 fs/btrfs/super.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c
index 15634d4..16f31e1 100644
--- a/fs/btrfs/super.c
+++ b/fs/btrfs/super.c
@@ -406,7 +406,7 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
         u64 *subvol_rootid, struct btrfs_fs_devices **fs_devices)
 {
     substring_t args[MAX_OPT_ARGS];
-    char *opts, *orig, *p;
+    char *device_name, *opts, *orig, *p;
Seems your email client replaced tabs with spaces.

Please read Documentation/email-clients.txt
quoted hunk ↗ jump to hunk
     int error = 0;
     int intarg;
@@ -457,8 +457,14 @@ static int btrfs_parse_early_options(const char *options, fmode_t flags,
             }
             break;
         case Opt_device:
-            error = btrfs_scan_one_device(match_strdup(&args[0]),
+            device_name = match_strdup(&args[0]);
+            if (!device_name) {
+                error = -ENOMEM;
+                goto out_free_opts;
+            }
+            error = btrfs_scan_one_device(device_name,
                     flags, holder, fs_devices);
+            kfree(device_name);
             if (error)
                 goto out_free_opts;
             break;
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help