This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


>>>>> "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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]