aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-objfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-objfile.c')
-rw-r--r--gdb/python/py-objfile.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/gdb/python/py-objfile.c b/gdb/python/py-objfile.c
index dc7f342..d15d5ec 100644
--- a/gdb/python/py-objfile.c
+++ b/gdb/python/py-objfile.c
@@ -143,12 +143,10 @@ objfpy_get_build_id (PyObject *self, void *closure)
if (build_id != NULL)
{
- char *hex_form = make_hex_string (build_id->data, build_id->size);
- PyObject *result;
+ gdb::unique_xmalloc_ptr<char> hex_form
+ (make_hex_string (build_id->data, build_id->size));
- result = host_string_to_python_string (hex_form).release ();
- xfree (hex_form);
- return result;
+ return host_string_to_python_string (hex_form.get ()).release ();
}
Py_RETURN_NONE;