[OTR-dev] memory leak in pidgin-otr

Jacob Appelbaum jacob at appelbaum.net
Sun Jan 27 18:54:34 EST 2013


Andreas Schlick:
> Hello,
> 
> the attached patch fixes what I think is a memory leak and an
> incorrect call to free() (the message provided by pidgin was
> allocated by g_strdup() and should be freed by g_free()).
> 

Thanks, I've merged this into a branch (ioerror/memory-leak-patch) for
Ian to review.

Ian and I were both curious about how this didn't cause a crash on
Windows. I suspect it is because free() and g_free() somehow behave
differently?

In any case, I believe that it is correct to g_free() the old message,
and then g_strdup("") for the message. It also seems reasonable that we
should free the old message and set message to newmessage with g_strdup.
If nothing else, we should always be using g_* for consistency.

It would be nice if any of the Windows users on this list could test
these changes to ensure that it doesn't crash or if it did leak memory,
to explain why free() doesn't crash whereas we think g_free() would
every time?

All the best,
Jacob




More information about the OTR-dev mailing list