Re: xfree() -- set ptr to nil (fwd)

J.T. Conklin
2001-02-12T15:54:00Z

>>>>> "John" == John R Moore <jmoore@cygnus.com> writes:
John> Yes, I've usually seen this as a macro
John>
John> #define XFREE(ptr) do \
John> { \
John> if (ptr) \
John> { \
John> free (ptr); \
John> ptr = NULL; \
John> } \
John> } while (0)
John>
John> Ok, then, do we want to replace xfree() with something like XFREE() ?

I'd say no, unless it has been established that we have a problem
where pointers are freed multiple times AND it's been determined that
its too difficult to fix the code to avoid the bug.

--jtc

--
J.T. Conklin
RedBack Networks