Ethereal-dev: [ethereal-dev] Incorrect use of malloc

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: "Graham Bloice" <graham.bloice@xxxxxxxxxxxxx>
Date: Fri, 7 Jul 2000 09:11:22 +0100
The attached patch corrects a debug assertion on Win32.

When a filter is applied by a Follow TCP Stream operation, pressing the
Reset Filter button brings up debug assertion (if glib has been built with
debugging on).  The cause is that build_follow_filter() in follow.c
allocates the filter buffer with malloc(), which is then freed with g_free()
in filter_packets().

The patch replaces the malloc() with g_malloc(), and a following free() with
a g_free().  I've checked for other suspicious uses of malloc() and free()
but they all seem OK.

I did note that packet_bgp is unique in using malloc() instead of
g_malloc().  Except.c also uses malloc().  Should these be converted to
g_malloc() ?

Regards,

Graham Bloice
Software Developer
Trihedral UK Limited

Tel: +44 (0)7002 874433
Fax: +44 (0)7002 228880

Email: mailto:graham.bloice@xxxxxxxxxxxxx
Web: http://www.trihedral.com

Attachment: follow.c.patch
Description: Binary data