Re: [RFC] Fix BFD leak in solib-darwin.c

John Baldwin
2019-02-26T20:36:59Z

On 2/26/19 12:18 PM, Tom Tromey wrote:
>>>>>> "John" == John Baldwin <jhb@FreeBSD.org> writes:
>
> Re-replying...
>
> John> Simon has noticed several instances of this bug where release()
> John> was used instead of reset().
>
> I wonder whether we ought to mark the release method as
> "warn_unused_result" to try to avoid future bugs like this. Another
> idea is to try to reduce the number of calls to release generally, by
> changing more things to take rvalue references or the like.

I think the warning would be useful if it doesn't trigger a lot of false
positives. I feel like it wouldn't today. When I was grep'ing for
'release ()' I only focused on the calls that weren't assigning a value
to a result and I feel like there weren't many of those (and some were
assigning, just not obvious in the one line of grep context).

--
John Baldwin

Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â