This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] valops.c (find_oload_champ): Free malloced pointer.


Joel Brobecker wrote:
2011-03-04 Michael Snyder <msnyder@msnyder-server.eng.vmware.com>

* valops.c (find_oload_champ): Free malloced pointer.

I don't think that this is correct. The code sets *oload_champ_bv to bv in certain cases. If you xfree bv, you'll be returning a dangling pointer.

It does look like there is a genuine memory leak however. The correct
fix is to xfree bv only if oload_champ_bv wasn't set to bv, though.
An easier-to-program-but-less-optimal solution could be to store
a duplicate of bv in oload_champ_bv and xfree bv at the end. Not too
fond of this, but I'm not sure the extra code to know whether or not
to xfree bv is going to be too elegant either...


Withdrawn.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]