Skip to content

Commit a36ca79

Browse files
committed
btrfs-progs: sb-mod: clean up used memory
ASAN build reports that there are some leaks: Direct leak of 7 byte(s) in 1 object(s) allocated from: #0 0x7f7fa15200e4 in strdup (/lib64/libasan.so.8+0x1200e4) #1 0x000000579d7e in main /home/ds/x/g/btrfs-progs/btrfs-sb-mod.c:417 #2 0x7f7fa102b2fa in __libc_start_call_main (/lib64/libc.so.6+0x2b2fa) #3 0x7ffce11eee69 ([stack]+0x20e69) SUMMARY: AddressSanitizer: 7 byte(s) leaked in 1 allocation(s). It's the operation name, so free it after it's processed. Signed-off-by: David Sterba <dsterba@suse.com>
1 parent f3e6118 commit a36ca79

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

btrfs-sb-mod.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ enum field_op {
9595
};
9696

9797
struct fspec {
98-
const char *name;
98+
char *name;
9999
enum field_op fop;
100100
u64 value;
101101
};
@@ -427,6 +427,7 @@ int main(int argc, char **argv)
427427
sb_edit(sb, &spec[i]);
428428
if (op_is_write(spec[i].fop))
429429
changed = 1;
430+
free(spec[i].name);
430431
}
431432

432433
if (changed) {

0 commit comments

Comments
 (0)