diff options
author | Brian Behlendorf <behlendorf1@llnl.gov> | 2007-03-21 16:48:47 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2007-03-21 16:48:47 -0400 |
commit | 2711ca1c2344b7a8d38e36508f3daae261da7a02 (patch) | |
tree | 410185bc7df3755be26dc558f61d874bb6c3abd5 /lib/e2p/feature.c | |
parent | 93503267c9765f80f8bbbdbb132d495a859361e1 (diff) | |
download | android_external_e2fsprogs-2711ca1c2344b7a8d38e36508f3daae261da7a02.tar.gz android_external_e2fsprogs-2711ca1c2344b7a8d38e36508f3daae261da7a02.tar.bz2 android_external_e2fsprogs-2711ca1c2344b7a8d38e36508f3daae261da7a02.zip |
[COVERITY] Fix memory leak in libe2p (e2p_edit_feature)
Coverity ID: 15: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'lib/e2p/feature.c')
-rw-r--r-- | lib/e2p/feature.c | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/lib/e2p/feature.c b/lib/e2p/feature.c index ea0c6fa0..fe7e65a8 100644 --- a/lib/e2p/feature.c +++ b/lib/e2p/feature.c @@ -165,10 +165,11 @@ static char *skip_over_word(char *cp) */ int e2p_edit_feature(const char *str, __u32 *compat_array, __u32 *ok_array) { - char *cp, *buf, *next; - int neg; + char *cp, *buf, *next; + int neg; unsigned int mask; int compat_type; + int rc = 0; buf = malloc(strlen(str)+1); if (!buf) @@ -200,15 +201,19 @@ int e2p_edit_feature(const char *str, __u32 *compat_array, __u32 *ok_array) cp++; break; } - if (e2p_string2feature(cp, &compat_type, &mask)) - return 1; - if (ok_array && !(ok_array[compat_type] & mask)) - return 1; + if (e2p_string2feature(cp, &compat_type, &mask)) { + rc = 1; + break; + } + if (ok_array && !(ok_array[compat_type] & mask)) { + rc = 1; + break; + } if (neg) compat_array[compat_type] &= ~mask; else compat_array[compat_type] |= mask; } - return 0; + free(buf); + return rc; } - |