X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fpython%2Fpy-type.c;h=da9dadd2fb07be053d7c75660cd4a506144909d9;hb=c92aed165e8af79f51c5165f98f12389bb59a121;hp=03cc8d9ecad20bbcb2752c9b5091664ec79060ea;hpb=02030646c2a799614d31e52008403d8be067ac5d;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/python/py-type.c b/gdb/python/py-type.c index 03cc8d9eca..da9dadd2fb 100644 --- a/gdb/python/py-type.c +++ b/gdb/python/py-type.c @@ -1010,8 +1010,7 @@ typy_template_argument (PyObject *self, PyObject *args) static PyObject * typy_str (PyObject *self) { - char *thetype = NULL; - long length = 0; + std::string thetype; PyObject *result; TRY @@ -1025,18 +1024,17 @@ typy_str (PyObject *self) LA_PRINT_TYPE (type_object_to_type (self), "", stb, -1, 0, &type_print_raw_options); - thetype = ui_file_xstrdup (stb, &length); + thetype = ui_file_as_string (stb); do_cleanups (old_chain); } CATCH (except, RETURN_MASK_ALL) { - xfree (thetype); GDB_PY_HANDLE_EXCEPTION (except); } END_CATCH - result = PyUnicode_Decode (thetype, length, host_charset (), NULL); - xfree (thetype); + result = PyUnicode_Decode (thetype.c_str (), thetype.length (), + host_charset (), NULL); return result; }