Re: Possibly Lost Error

David Anderson via Valgrind-users <[email protected]> Tue, 12 Nov 2024 15:42:20 -0800
Newsgroups gmane.comp.debugging.valgrind
Message-ID <[email protected]>
On 11/12/24 13:22, William Chan (BLOOMBERG/ 919 3RD A) wrote:
> Hi,
>
> I have a program that induces a possibly lost warning via an interior
> pointer but I deallocate the pointer properly. Is Valgrind supposed to
> be able to know that an interior pointer is freed? I'm trying to
> determine whether or not my possibly lost warning is safe to ignore.

I suggest that a principle of defensive programming is

free(x);
x = 0; /* or x = NULL if you prefer */

Whether this make a difference here ... no idea, sorry.
David Anderson