aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYao Qi <yao.qi@linaro.org>2017-02-23 11:57:46 +0000
committerYao Qi <yao.qi@linaro.org>2017-02-23 11:57:46 +0000
commit387687511347d5e978bb47d193fe67c25e0e10a6 (patch)
tree6634dc0939d45a5c8a4203c62f52f5106e723ddf
parent0a8beaba19a991bbfcf03756c4a150bf9512a164 (diff)
downloadgdb-387687511347d5e978bb47d193fe67c25e0e10a6.zip
gdb-387687511347d5e978bb47d193fe67c25e0e10a6.tar.gz
gdb-387687511347d5e978bb47d193fe67c25e0e10a6.tar.bz2
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 <yao.qi@linaro.org> * varobj-iter.h (varobj_iter_delete): Call xfree instead of delete.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/varobj-iter.h2
2 files changed, 6 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ade40bd..6cc163b 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2017-02-23 Yao Qi <yao.qi@linaro.org>
+ * varobj-iter.h (varobj_iter_delete): Call xfree instead of
+ delete.
+
+2017-02-23 Yao Qi <yao.qi@linaro.org>
+
* varobj.c (varobj_clear_saved_item): Use delete instead of
xfree.
(update_dynamic_varobj_children): Likewise.
diff --git a/gdb/varobj-iter.h b/gdb/varobj-iter.h
index 34182e0..7eed4f1 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)