On Mon, Jul 22, 2013 at 5:33 PM, Giuseppe Scrivano <[email protected]>wrote:
> Darshit Shah <[email protected]> writes: > > > Should we xfree_null (qop) before setting it to NULL? > > > > > > qop will ALWAYS be xfree'd if it is explicitly set to NULL. The if > > statement on the next line takes care of that. > > sorry, I still don't understand it. Won't "xfree_null (qop)" be a NOP > when qop is NULL? > > AFAICS, we can access the memory pointed by qop only trough the qop > pointer itself, if we set qop to NULL then we have lost access to the > memory. > > Please note that xfree_null is defined in utils.h as: > > #define xfree_null(p) if (!(p)) ; else xfree (p) > > > > > In the original code, we set user to NULL while it was xfree'd only at > > termination time. > > The original code was leaking memory, so please don't take it as an > example :-) digest_authentication_encode doesn't allocate "user", so in > any case digest_authentication_encode is not the right place to free it. > > Right. My bad. I assumed that the original code was perfect and went along with it. I set xfree_null(qop) in both the places, however, I now encounter a SIGSEGV at log.c:450. I'll debug it and see what I can do. -- Thanking You, Darshit Shah
