[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Some memory management problems

GOMBAS Gabor <gombasg@inf.elte.hu> writes:
> I've got segmentation faults in free_general_string and free_octet_string. 

I see.  This is probably caused by some code freeing more than once.

> I have used dmalloc and gdb to debug the problem. The "ptr = NULL" style
> assignments in my patch made the segfaults go away, and the tests for
> malloc'ing 0 bytes and free'ing NULL made dmalloc to shut up.

I'm unfamiliar with dmalloc, but it should be possible (or even the
default) getting it to shut up about malloc(0) and free(NULL).

> So these tests may not be neccessary, but resetting pointers to NULL
> after they'd been freed is neccessary.

In this particular case, I would say that it actually only hides, the
real problem, which is multiple frees.

Do you have any hints on how to reproduce these problems so that we
can try debugging them?