Jack said:
Yes, he can. As far as the C language is concerned, and that's the
only thing that counts here, free() was properly called on a pointer
returned from malloc(). Since the free() function cannot fail if
called correctly, as it is in this case, the memory was freed.
Neither Ian nor I have to know much about valgrind, the Magna Carta,
or a Comcast commercial featuring the Slowskys, to state that if they
say this memory was not freed, the are wrong.
Something of a straw man, Jack. Whoever said that the memory was not
freed? Valgrind reportedly said "16 byts (sic) in 1 block still
reachable". Does that have anything to do with memory being freed? I
don't know. I have no idea what it means. I don't know whether or not it
is wrong, since I don't know what it is trying to say. Ian appears to be
in much the same position as me, since when asked what it means he said
"I've no idea, never having used valgrind". However, he went on to say
that the message was wrong. Since he does not know what the message
means he cannot know it is wrong, and is wrong to say that it is wrong.
For all that you, I, or Ian know, it might be Valgrind's obscure way of
saying "all memory allocated by malloc() has been correctly freed".
The memory was freed in the only context that matters in this group.
The OP's question may be off-topic, but that doesn't impinge on whether
or not the message was wrong; it impinges on our ability to say whether
or not the message was wrong.