From: Kp Date: Sun, 1 Jun 2008 17:25:50 +0000 (-0500) Subject: Packet streams: fix memory leak on dlist allocation failure. X-Git-Tag: silc.server.1.1.13^2~4 X-Git-Url: http://git.silcnet.org/gitweb/?p=silc.git;a=commitdiff_plain;h=7ebc6fcc9308c92130d59641b9f85341e609708b Packet streams: fix memory leak on dlist allocation failure. If silc_dlist_init fails to allocate a SilcDList for stream->process, then silc_packet_stream_link_va leaks the newly allocated SilcPacketProcess. Fix that by calling silc_free(p) on the error path. --- diff --git a/lib/silccore/silcpacket.c b/lib/silccore/silcpacket.c index d0445019..df195f67 100644 --- a/lib/silccore/silcpacket.c +++ b/lib/silccore/silcpacket.c @@ -1030,6 +1030,7 @@ static SilcBool silc_packet_stream_link_va(SilcPacketStream stream, stream->process = silc_dlist_init(); if (!stream->process) { silc_mutex_unlock(stream->lock); + silc_free(p); return FALSE; } }