Coverity ID: 15: Resource Leak
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+2007-03-21 Theodore Tso <tytso@mit.edu>
+
+ * feature.c (e2p_edit_feature): Fix memory leak.
+
2006-11-12 Theodore Tso <tytso@mit.edu>
* feature.c: Add support for printing the huge_file, gdt_checksum,
*/
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)
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;
}
-