This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
FYI: fix PR 10666
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 21 Sep 2009 10:18:17 -0600
- Subject: FYI: fix PR 10666
- Reply-to: tromey at redhat dot com
I'm checking this in on the trunk and the 7.0 branch.
This fixes PR 10666, a crash that happens when redefining a convenience
function. The bug is that we free some memory inappropriately; the fix
is to make sure the memory is heap-allocated.
This is a modified version of the patch sent by the bug submitter.
It is small enough not to need paperwork.
Tom
2009-09-21 Jason Orendorff <jason.orendorff@gmail.com>
PR python/10666:
* python/py-function.c (fnpy_init): Use xstrdup.
Index: python/py-function.c
===================================================================
RCS file: /cvs/src/src/gdb/python/py-function.c,v
retrieving revision 1.1
diff -u -r1.1 py-function.c
--- python/py-function.c 9 Sep 2009 17:45:40 -0000 1.1
+++ python/py-function.c 21 Sep 2009 16:16:52 -0000
@@ -112,11 +112,10 @@
{
PyObject *ds_obj = PyObject_GetAttrString (self, "__doc__");
if (ds_obj && gdbpy_is_string (ds_obj))
- /* Nothing ever frees this. */
docstring = python_string_to_host_string (ds_obj);
}
if (! docstring)
- docstring = _("This function is not documented.");
+ docstring = xstrdup (_("This function is not documented."));
add_internal_function (name, docstring, fnpy_call, self);
return 0;