Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gdb/dist/gdb CID 1102803: Memory leak



details:   https://anonhg.NetBSD.org/src/rev/3539ea31ce5a
branches:  trunk
changeset: 791354:3539ea31ce5a
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Nov 14 02:26:35 2013 +0000

description:
CID 1102803: Memory leak

diffstat:

 external/gpl3/gdb/dist/gdb/varobj.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r fa5cfd75dd76 -r 3539ea31ce5a external/gpl3/gdb/dist/gdb/varobj.c
--- a/external/gpl3/gdb/dist/gdb/varobj.c       Thu Nov 14 01:39:26 2013 +0000
+++ b/external/gpl3/gdb/dist/gdb/varobj.c       Thu Nov 14 02:26:35 2013 +0000
@@ -1658,11 +1658,13 @@
        {
          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 @@
              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;
        }
     }
 



Home | Main Index | Thread Index | Old Index