Daily snapshots |
Mailing list archive |
This month's Index
NULL after *_free?
I was running across some crashes in my code and while I think the original
crash was not due to libssh2, I saw some things in libssh2 that I don't know
are optimal. In libssh2_session_free and libssh2_channel_free, we do free()
the memory and then leave the pointer to whatever. In debug versions of VC++
binaries, free'd pointers are given a specific address (0xFEEEFEEE) to
signify to the debugger that the memory has been free()'d. The problem in my
code is I have a FREE macro that checks if a pointer is NULL and if not,
free()'s it. You can image the rest, a pointer of 0xFEEEFEEE is not NULL but
free()ing that will be bad. Should we set pointers to NULL after free()'ing
them, or is that the responsibility of the application?
Received on 2010-02-11
the libssh2 team