Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] varobj.c, value_of_root, (another) memory leak
@ 2007-08-10 23:01 msnyder
  2007-08-11  1:40 ` Nick Roberts
  0 siblings, 1 reply; 5+ messages in thread
From: msnyder @ 2007-08-10 23:01 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 164 bytes --]

I'm not totally sure about this -- does the return value of var_get_type
need to be freed?  If so, there are some other places in mi-cmd-var
where it isn't being.


[-- Attachment #2: 147.txt --]
[-- Type: text/plain, Size: 580 bytes --]

2007-08-10  Michael Snyder  <msnyder@access-company.com>

	* varobj.c (value_of_root): Memory leak.

Index: varobj.c
===================================================================
RCS file: /cvs/src/src/gdb/varobj.c,v
retrieving revision 1.90
diff -p -r1.90 varobj.c
*** varobj.c	8 Aug 2007 21:46:37 -0000	1.90
--- varobj.c	10 Aug 2007 22:58:51 -0000
*************** value_of_root (struct varobj **var_handl
*** 1741,1746 ****
--- 1741,1748 ----
  	  var = *var_handle;
  	  *type_changed = 1;
  	}
+       xfree (old_type);
+       xfree (new_type);
      }
    else
      {

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] varobj.c, value_of_root, (another) memory leak
  2007-08-10 23:01 [PATCH] varobj.c, value_of_root, (another) memory leak msnyder
@ 2007-08-11  1:40 ` Nick Roberts
  2007-08-11  2:41   ` Daniel Jacobowitz
  2007-08-17 23:21   ` msnyder
  0 siblings, 2 replies; 5+ messages in thread
From: Nick Roberts @ 2007-08-11  1:40 UTC (permalink / raw)
  To: msnyder; +Cc: gdb-patches

 > I'm not totally sure about this -- does the return value of var_get_type
 > need to be freed?  If so, there are some other places in mi-cmd-var
 > where it isn't being.

Yes, I think this is right but USE_SELECTED_FRAME is broken anyway.  The
ones in mi-cmd-var.c may be more important.  Similar problems seem to
occur with varobj_get_expression and varobj_get_value. Since the expression
associated with a variable object doesn't change, I think c_name_of_variable
could just be:

static char *
c_name_of_variable (struct varobj *var)
{
  return var->name;
}

Are we close to release or branchpoint?  If not let's do these things now.
I also have a patch for editable/changeable properties of variable ojects
which I'd like to resubmit for approval if a release is no longer imminent.

-- 
Nick                                           http://www.inet.net.nz/~nickrob


 > 2007-08-10  Michael Snyder  <msnyder@access-company.com>
 > 
 > 	* varobj.c (value_of_root): Memory leak.
 > 
 > Index: varobj.c
 > ===================================================================
 > RCS file: /cvs/src/src/gdb/varobj.c,v
 > retrieving revision 1.90
 > diff -p -r1.90 varobj.c
 > *** varobj.c	8 Aug 2007 21:46:37 -0000	1.90
 > --- varobj.c	10 Aug 2007 22:58:51 -0000
 > *************** value_of_root (struct varobj **var_handl
 > *** 1741,1746 ****
 > --- 1741,1748 ----
 >   	  var = *var_handle;
 >   	  *type_changed = 1;
 >   	}
 > +       xfree (old_type);
 > +       xfree (new_type);
 >       }
 >     else
 >       {


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] varobj.c, value_of_root, (another) memory leak
  2007-08-11  1:40 ` Nick Roberts
@ 2007-08-11  2:41   ` Daniel Jacobowitz
  2007-08-11 20:10     ` msnyder
  2007-08-17 23:21   ` msnyder
  1 sibling, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-08-11  2:41 UTC (permalink / raw)
  To: Nick Roberts; +Cc: msnyder, gdb-patches

On Sat, Aug 11, 2007 at 01:40:33PM +1200, Nick Roberts wrote:
> Are we close to release or branchpoint?

I hope that we branch the moment we have decided how to handle GPLv3.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] varobj.c, value_of_root, (another) memory leak
  2007-08-11  2:41   ` Daniel Jacobowitz
@ 2007-08-11 20:10     ` msnyder
  0 siblings, 0 replies; 5+ messages in thread
From: msnyder @ 2007-08-11 20:10 UTC (permalink / raw)
  To: Nick Roberts, msnyder, gdb-patches

> On Sat, Aug 11, 2007 at 01:40:33PM +1200, Nick Roberts wrote:
>> Are we close to release or branchpoint?
>
> I hope that we branch the moment we have decided how to handle GPLv3.

Shall I hold back this patch then ?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] varobj.c, value_of_root, (another) memory leak
  2007-08-11  1:40 ` Nick Roberts
  2007-08-11  2:41   ` Daniel Jacobowitz
@ 2007-08-17 23:21   ` msnyder
  1 sibling, 0 replies; 5+ messages in thread
From: msnyder @ 2007-08-17 23:21 UTC (permalink / raw)
  To: Nick Roberts; +Cc: msnyder, gdb-patches

>  > I'm not totally sure about this -- does the return value of
> var_get_type
>  > need to be freed?  If so, there are some other places in mi-cmd-var
>  > where it isn't being.
>
> Yes, I think this is right but USE_SELECTED_FRAME is broken anyway.  The
> ones in mi-cmd-var.c may be more important.  Similar problems seem to
> occur with varobj_get_expression and varobj_get_value.

Committed.



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-08-17 23:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-10 23:01 [PATCH] varobj.c, value_of_root, (another) memory leak msnyder
2007-08-11  1:40 ` Nick Roberts
2007-08-11  2:41   ` Daniel Jacobowitz
2007-08-11 20:10     ` msnyder
2007-08-17 23:21   ` msnyder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox