+2015-01-30 Simon Marchi <simon.marchi@ericsson.com>
+
+ * mi-cmd-var.c (print_varobj): Free varobj_get_expression
+ result.
+ (mi_cmd_var_info_expression): Same.
+ * varobj.c (varobj_get_expression): Mention in the comment that
+ the result must by freed by the caller.
+
2015-01-30 Simon Marchi <simon.marchi@ericsson.com>
* mi/mi-cmd-var.c (mi_cmd_var_info_type): Free result of
ui_out_field_string (uiout, "name", varobj_get_objname (var));
if (print_expression)
- ui_out_field_string (uiout, "exp", varobj_get_expression (var));
+ {
+ char *exp = varobj_get_expression (var);
+
+ ui_out_field_string (uiout, "exp", exp);
+ xfree (exp);
+ }
ui_out_field_int (uiout, "numchild", varobj_get_num_children (var));
if (mi_print_value_p (var, print_values))
struct ui_out *uiout = current_uiout;
const struct language_defn *lang;
struct varobj *var;
+ char *exp;
if (argc != 1)
error (_("-var-info-expression: Usage: NAME."));
lang = varobj_get_language (var);
ui_out_field_string (uiout, "lang", lang->la_natural_name);
- ui_out_field_string (uiout, "exp", varobj_get_expression (var));
+
+ exp = varobj_get_expression (var);
+ ui_out_field_string (uiout, "exp", exp);
+ xfree (exp);
}
void
return var->obj_name;
}
-/* Given the handle, return the expression represented by the object. */
+/* Given the handle, return the expression represented by the object. The
+ result must be freed by the caller. */
char *
varobj_get_expression (struct varobj *var)