]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
[COVERITY] Fix memory leak when parsing extended options in e2fsck
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 28 Mar 2007 15:28:24 +0000 (11:28 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Wed, 28 Mar 2007 15:28:24 +0000 (11:28 -0400)
Coverity ID: 35: Resource Leak

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
e2fsck/ChangeLog
e2fsck/unix.c

index 8d5e491c4be56518f5625500cdd2c852adc58e57..7dbd05a938be43fbd90102bcc5395cf4a3aa26f6 100644 (file)
@@ -1,3 +1,7 @@
+2007-03-28  Theodore Tso  <tytso@mit.edu>
+
+       * unix.c (parse_extended_opts): Fix memory leak
+
 2007-03-21  Theodore Tso  <tytso@mit.edu>
 
        * profile.c (profile_open_file): Fix memory leak if malloc() fails
index 898bc337c79d9c5a51af87c4153c2e19300cdc5d..7631c147793e2c65e9d2057391795b510e67bf2a 100644 (file)
@@ -523,7 +523,7 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts)
                if (p) {
                        *p = 0;
                        next = p+1;
-               } 
+               }
                arg = strchr(token, '=');
                if (arg) {
                        *arg = 0;
@@ -549,6 +549,8 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts)
                        extended_usage++;
                }
        }
+       free(buf);
+
        if (extended_usage) {
                fputs(("\nExtended options are separated by commas, "
                       "and may take an argument which\n"
@@ -557,7 +559,7 @@ static void parse_extended_opts(e2fsck_t ctx, const char *opts)
                       "\tea_ver=<ea_version (1 or 2)>\n\n"), stderr);
                exit(1);
        }
-}      
+}
 
 static void syntax_err_report(const char *filename, long err, int line_num)
 {