Commit 5493ce7
wt-status: fix multiple small leaks
rev.prune_data is populated (in multiple functions) via copy_pathspec,
and therefore needs to be cleared after running the diff in those
functions.
rev(_info).pending is populated indirectly via setup_revisions, and also
needs to be cleared once diffing is done.
These leaks were found while running t0008 or t0021. The rev.prune_data
leaks are small (80B) but noisy, hence I won't bother including their
logs - the rev.pending leaks are bigger, and can happen early in the
course of other commands, and therefore possibly more valuable to fix -
see example log from a rebase below:
Direct leak of 2048 byte(s) in 1 object(s) allocated from:
#0 0x49ab79 in realloc ../projects/compiler-rt/lib/asan/asan_malloc_linux.cpp:164:3
microsoft#1 0x9ac2a6 in xrealloc wrapper.c:126:8
microsoft#2 0x83da03 in add_object_array_with_path object.c:337:3
microsoft#3 0x8f5d8a in add_pending_object_with_path revision.c:329:2
microsoft#4 0x8ea50b in add_pending_object_with_mode revision.c:336:2
microsoft#5 0x8ea4fd in add_pending_object revision.c:342:2
microsoft#6 0x8ea610 in add_head_to_pending revision.c:354:2
microsoft#7 0x9b55f5 in has_uncommitted_changes wt-status.c:2474:2
microsoft#8 0x9b58c4 in require_clean_work_tree wt-status.c:2553:6
microsoft#9 0x606bcc in cmd_rebase builtin/rebase.c:1970:6
microsoft#10 0x4cd91d in run_builtin git.c:467:11
microsoft#11 0x4cb5f3 in handle_builtin git.c:719:3
microsoft#12 0x4ccf47 in run_argv git.c:808:4
microsoft#13 0x4caf49 in cmd_main git.c:939:19
microsoft#14 0x69dc0e in main common-main.c:52:11
microsoft#15 0x7f2d18909349 in __libc_start_main (/lib64/libc.so.6+0x24349)
Indirect leak of 5 byte(s) in 1 object(s) allocated from:
#0 0x486834 in strdup ../projects/compiler-rt/lib/asan/asan_interceptors.cpp:452:3
microsoft#1 0x9ac048 in xstrdup wrapper.c:29:14
microsoft#2 0x83da8d in add_object_array_with_path object.c:349:17
microsoft#3 0x8f5d8a in add_pending_object_with_path revision.c:329:2
microsoft#4 0x8ea50b in add_pending_object_with_mode revision.c:336:2
microsoft#5 0x8ea4fd in add_pending_object revision.c:342:2
microsoft#6 0x8ea610 in add_head_to_pending revision.c:354:2
microsoft#7 0x9b55f5 in has_uncommitted_changes wt-status.c:2474:2
microsoft#8 0x9b58c4 in require_clean_work_tree wt-status.c:2553:6
microsoft#9 0x606bcc in cmd_rebase builtin/rebase.c:1970:6
microsoft#10 0x4cd91d in run_builtin git.c:467:11
microsoft#11 0x4cb5f3 in handle_builtin git.c:719:3
microsoft#12 0x4ccf47 in run_argv git.c:808:4
microsoft#13 0x4caf49 in cmd_main git.c:939:19
microsoft#14 0x69dc0e in main common-main.c:52:11
microsoft#15 0x7f2d18909349 in __libc_start_main (/lib64/libc.so.6+0x24349)
SUMMARY: AddressSanitizer: 2053 byte(s) leaked in 2 allocation(s).
Signed-off-by: Andrzej Hunt <ajrhunt@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent db69bf6 commit 5493ce7
1 file changed
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
616 | 616 | | |
617 | 617 | | |
618 | 618 | | |
| 619 | + | |
619 | 620 | | |
620 | 621 | | |
621 | 622 | | |
| |||
652 | 653 | | |
653 | 654 | | |
654 | 655 | | |
| 656 | + | |
| 657 | + | |
655 | 658 | | |
656 | 659 | | |
657 | 660 | | |
| |||
2480 | 2483 | | |
2481 | 2484 | | |
2482 | 2485 | | |
| 2486 | + | |
2483 | 2487 | | |
2484 | 2488 | | |
2485 | 2489 | | |
| |||
0 commit comments