X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fpython%2Fpy-infthread.c;h=3cc359c4a79e283e5f724d6c10125b4b608da508;hb=9b9720149dfee4a9a961c29d0382fc5bdf9c975b;hp=697298d19dd29da3f729e17cd5e4a582bc4ff482;hpb=4e9d2153228d95c972907a8b13237218d380c5d3;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/python/py-infthread.c b/gdb/python/py-infthread.c index 697298d19d..3cc359c4a7 100644 --- a/gdb/python/py-infthread.c +++ b/gdb/python/py-infthread.c @@ -80,7 +80,7 @@ static int thpy_set_name (PyObject *self, PyObject *newvalue, void *ignore) { thread_object *thread_obj = (thread_object *) self; - char *name; + gdb::unique_xmalloc_ptr name; if (! thread_obj->thread) { @@ -95,7 +95,9 @@ thpy_set_name (PyObject *self, PyObject *newvalue, void *ignore) return -1; } else if (newvalue == Py_None) - name = NULL; + { + /* Nothing. */ + } else if (! gdbpy_is_string (newvalue)) { PyErr_SetString (PyExc_TypeError, @@ -110,7 +112,7 @@ thpy_set_name (PyObject *self, PyObject *newvalue, void *ignore) } xfree (thread_obj->thread->name); - thread_obj->thread->name = name; + thread_obj->thread->name = name.release (); return 0; }