[PATCH] Packet streams: fix memory leak on dlist allocation failure.
Kp <[email protected]> Sun, 22 Jun 2008 13:08:17 -0500
| Newsgroups | gmane.network.silc.devel |
|---|---|
| Message-ID | <[email protected]> |
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. The attached patch should be applicable via "git am" against the tip of silc.1.1.branch, currently at 4d26d9f598384d7cd49c6238ea4a81b9f4e6f212. _______________________________________________________________________ Info: https://lists.silcnet.org/mailman/listinfo/silc-announce Archive: https://lists.silcnet.org/pipermail/silc-announce FAQ: http://silcnet.org/support/faq/
0002-Packet-streams-fix-memory-leak-on-dlist-allocation.patch
(text/plain, 961 B)
From a70b40af252e1ccd2e0286c2abc8a6ff4aaf2528 Mon Sep 17 00:00:00 2001 From: [email protected] <[email protected]> Date: Sun, 1 Jun 2008 12:25:50 -0500 Subject: [PATCH] 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. --- lib/silccore/silcpacket.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/lib/silccore/silcpacket.c b/lib/silccore/silcpacket.c index 8748370..378e664 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; } } -- 1.5.5.4