From: Yao Qi Date: Thu, 23 Feb 2017 11:57:46 +0000 (+0000) Subject: Use xfree rather than delete for varobj_iter X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=387687511347d5e978bb47d193fe67c25e0e10a6;p=binutils-gdb.git Use xfree rather than delete for varobj_iter ASAN reports an error, -var-create container @ c^M =================================================================^M ^[[1m^[[31m==21639==ERROR: AddressSanitizer: alloc-dealloc-mismatch (malloc vs operator delete) on 0x6030000805c0^M ^[[1m^[[0m #0 0x7f2449b01b2a in operator delete(void*) (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x99b2a)^M #1 0xbb601d in update_dynamic_varobj_children ../../binutils-gdb/gdb/varobj.c:794^M #2 0xbb6556 in varobj_get_num_children(varobj*) ../../binutils-gdb/gdb/varobj.c:854^M #3 0x580cb4 in print_varobj ../../binutils-gdb/gdb/mi/mi-cmd-var.c:61^M #4 0x58138b in mi_cmd_var_create(char*, char**, int) ../../binutils-gdb/gdb/mi/mi-cmd-var.c:145^M #5 0x5967ce in mi_cmd_execute ../../binutils-gdb/gdb/mi/mi-main.c:2301^M #6 0x594b05 in captured_mi_execute_command ../../binutils-gdb/gdb/mi/mi-main.c:2001 .... ^M ^[[1m^[[32m0x6030000805c0 is located 0 bytes inside of 32-byte region [0x6030000805c0,0x6030000805e0)^M ^[[1m^[[0m^[[1m^[[35mallocated by thread T0 here:^[[1m^[[0m^M #0 0x7f2449b00602 in malloc (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x98602)^M #1 0x7d1596 in xmalloc ../../binutils-gdb/gdb/common/common-utils.c:43^M #2 0x604176 in py_varobj_iter_new ../../binutils-gdb/gdb/python/py-varobj.c:159^M #3 0x6042da in py_varobj_get_iterator(varobj*, _object*) ../../binutils-gdb/gdb/python/py-varobj.c:198^M #4 0xbb5806 in varobj_get_iterator ../../binutils-gdb/gdb/varobj.c:720^M #5 0xbb5b9b in update_dynamic_varobj_children ../../binutils-gdb/gdb/varobj.c:758^M gdb: 2017-02-23 Yao Qi * varobj-iter.h (varobj_iter_delete): Call xfree instead of delete. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ade40bd8d48..6cc163b3dee 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2017-02-23 Yao Qi + + * varobj-iter.h (varobj_iter_delete): Call xfree instead of + delete. + 2017-02-23 Yao Qi * varobj.c (varobj_clear_saved_item): Use delete instead of diff --git a/gdb/varobj-iter.h b/gdb/varobj-iter.h index 34182e050ab..7eed4f18454 100644 --- a/gdb/varobj-iter.h +++ b/gdb/varobj-iter.h @@ -67,6 +67,6 @@ struct varobj_iter_ops if ((ITER) != NULL) \ { \ (ITER)->ops->dtor (ITER); \ - delete (ITER); \ + xfree (ITER); \ } \ } while (0)