]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/record-full.c
Fix leak in record-full.c
authorPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 1 Jan 2019 13:12:30 +0000 (14:12 +0100)
committerPhilippe Waroquiers <philippe.waroquiers@skynet.be>
Tue, 1 Jan 2019 19:28:55 +0000 (20:28 +0100)
commitec70d8db32462176e7da60d28b0c1978fc6b70d3
treea184ba43e15f764b3a12e76646b6932871697ab9
parent5b38f9c16e5b3f5f4b5d7772bfef59b1c97e2d05
Fix leak in record-full.c

valgrind detects leaks in several gdb.reverse tests,
such as the below in gdb.reverse/watch-precsave.exp.

Fix the leak by rewriting the loop that frees
record_full_core_buf_list.

gdb/ChangeLog
2019-01-01  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

* record-full.c (record_full_base_target::close): Rewrite
record_full_core_buf_list free logic.

==18847== VALGRIND_GDB_ERROR_BEGIN
==18847== 4,120 (24 direct, 4,096 indirect) bytes in 1 blocks are definitely lost in loss record 3,094 of 3,199
==18847==    at 0x4C2BE6D: malloc (vg_replace_malloc.c:309)
==18847==    by 0x405097: xmalloc (common-utils.c:44)
==18847==    by 0x5AF8EA: xnew<record_full_core_buf_entry> (poison.h:110)
==18847==    by 0x5AF8EA: record_full_core_target::xfer_partial(target_object, char const*, unsigned char*, unsigned char const*, unsigned long, unsigned long, unsigned long*) (record-full.c:2182)
==18847==    by 0x64677D: raw_memory_xfer_partial(target_ops*, unsigned char*, unsigned char const*, unsigned long, long, unsigned long*) (target.c:956)
==18847==    by 0x64691E: memory_xfer_partial_1(target_ops*, target_object, unsigned char*, unsigned char const*, unsigned long, unsigned long, unsigned long*) (target.c:1086)
gdb/ChangeLog
gdb/record-full.c