This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] [python] Fix for double-free.
- From: ppluzhnikov at google dot com (Paul Pluzhnikov)
- To: gdb-patches at sourceware dot org
- Date: Thu, 23 Oct 2008 10:21:58 -0700 (PDT)
- Subject: [patch] [python] Fix for double-free.
Greetings,
I made the change below on archer-tromey-python.
Unfortunately, I can't seem to be able to construct a test case
which exposes this bug.
OK to commit without a test case?
Thanks,
--
Paul Pluzhnikov
2008-10-23 Paul Pluzhnikov <ppluzhnikov@google.com>
* python/python-value (valpy_getitem): Fix heap corruption.
diff --git a/gdb/python/python-value.c b/gdb/python/python-value.c
index 93af465..5064ccf 100644
--- a/gdb/python/python-value.c
+++ b/gdb/python/python-value.c
@@ -209,7 +209,8 @@ valpy_getitem (PyObject *self, PyObject *key)
TRY_CATCH (except, RETURN_MASK_ALL)
{
- res_val = value_struct_elt (&self_value->value, NULL, field, 0, NULL);
+ struct value *tmp = self_value->value;
+ res_val = value_struct_elt (&tmp, NULL, field, 0, NULL);
}
GDB_PY_HANDLE_EXCEPTION (except);