Module Name: src
Committed By: christos
Date: Thu Nov 14 02:26:35 UTC 2013
Modified Files:
src/external/gpl3/gdb/dist/gdb: varobj.c
Log Message:
CID 1102803: Memory leak
To generate a diff of this commit:
cvs rdiff -u -r1.1.1.2 -r1.2 src/external/gpl3/gdb/dist/gdb/varobj.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/gpl3/gdb/dist/gdb/varobj.c
diff -u src/external/gpl3/gdb/dist/gdb/varobj.c:1.1.1.2 src/external/gpl3/gdb/dist/gdb/varobj.c:1.2
--- src/external/gpl3/gdb/dist/gdb/varobj.c:1.1.1.2 Thu Oct 3 11:50:32 2013
+++ src/external/gpl3/gdb/dist/gdb/varobj.c Wed Nov 13 21:26:35 2013
@@ -1658,11 +1658,13 @@ update_type_if_necessary (struct varobj
{
struct type *new_type;
char *curr_type_str, *new_type_str;
+ int rv;
new_type = value_actual_type (new_value, 0, 0);
new_type_str = type_to_string (new_type);
curr_type_str = varobj_get_type (var);
- if (strcmp (curr_type_str, new_type_str) != 0)
+ rv = strcmp (curr_type_str, new_type_str) != 0;
+ if (rv)
{
var->type = new_type;
@@ -1670,8 +1672,10 @@ update_type_if_necessary (struct varobj
varobj_delete (var, NULL, 1);
VEC_free (varobj_p, var->children);
var->num_children = -1;
- return 1;
}
+ xfree (new_type_str);
+ xfree (curr_type_str);
+ return rv;
}
}