From b47413b47e103677fedb7cd1301c62fee01ac4ba Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Tue, 31 Jan 2017 17:56:36 +0000 Subject: [PATCH] gdb/varobj.c: Fix leak Whoops, this function returns a std::string. gdb/ChangeLog: 2017-01-31 Pedro Alves * varobj.c (varobj_value_get_print_value): Remove xstrdup call. --- gdb/ChangeLog | 4 ++++ gdb/varobj.c | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 3e86d55066..5e822f81a4 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2017-01-31 Pedro Alves + + * varobj.c (varobj_value_get_print_value): Remove xstrdup call. + 2017-01-31 Pedro Alves * common/scoped_restore.h diff --git a/gdb/varobj.c b/gdb/varobj.c index 30dfb862d5..bcca6c6efb 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -2432,7 +2432,7 @@ varobj_value_get_print_value (struct value *value, if (dynamic_varobj_has_child_method (var)) { do_cleanups (old_chain); - return xstrdup ("{...}"); + return "{...}"; } if (PyObject_HasAttr (value_formatter, gdbpy_to_string_cst))