Free results of varobj_get_type and type_to_string
authorSimon Marchi <simon.marchi@ericsson.com>
Fri, 30 Jan 2015 18:54:50 +0000 (13:54 -0500)
committerSimon Marchi <simon.marchi@ericsson.com>
Fri, 30 Jan 2015 18:54:50 +0000 (13:54 -0500)
commitafa269ae41673cd5cc5f50d683a0f2d275a643e8
treecd6896ed98d9a264c3bcc8f97aefd8bc3504fc40
parent9fc1d6863b1f46fd639afc3dfbe0b4c6d809ac05
Free results of varobj_get_type and type_to_string

varobj_get_type and type_to_string return an allocated string, which is
not freed at a couple of places.

New in v2:
 * Rename char * type to type_name.
 * Free in all cases in update_type_if_necessary.

gdb/ChangeLog:

* mi/mi-cmd-var.c (mi_cmd_var_info_type): Free result of
varobj_get_type.
(varobj_update_one): Same.
* varobj.c (update_type_if_necessary): Free curr_type_str and
new_type_str.
(varobj_get_type): Specify in comment that the result needs to be
freed by the caller.
gdb/ChangeLog
gdb/mi/mi-cmd-var.c
gdb/varobj.c