[PATCH] Fix badness vector resource leaks found by Coverity

Gary Benson gbenson@redhat.com
Wed Oct 10 14:20:00 GMT 2018


Pedro Alves wrote:
> Please use some more descriptive subject in these emails/commits,
> otherwise we're going to end up with dozens of indistinct 
> "Fix resource leak found by Coverity" patches/emails.  :-)

Yeah, it just occurred to me to do that, after I looked in my
inbox :D

> As for the patch itself, I think that we'd still be leaking
> bv->rank, right?  Not just here, but in the callers of rank_function
> as well?

Oh, I just looked in valops.c to see what other things did to
free the vectors.  So there's other leaks in there as well :/

> I have a patch from last year here that converts the badness
> vector to a C++ std::vector:
> 
>  https://github.com/palves/gdb/commits/palves/badness_vector
> 
> See top two commits.
> 
> I guess a better approach would be to get that in instead.
> 
> Simon had a badness_vector C++ification patch too,
> though his was different.  ISTR that I prefer my approach,
> but I won't be surprised if Simon preferred his.  :-)

I'll look at them.  Were they ever submitted, or unfinished, or... ?

Cheers,
Gary



More information about the Gdb-patches mailing list