Packet streams: fix memory leak on dlist allocation failure.
[silc.git] / lib / silccore / silcpacket.c
index 251ee73a99b9fce432a42d2ae40d50417082318b..df195f678075c20fb495b276977965221cebfbd0 100644 (file)
@@ -621,7 +621,7 @@ void silc_packet_engine_stop(SilcPacketEngine engine)
   silc_free(engine);
 }
 
-static const char *packet_error[] = {
+static const char * const packet_error[] = {
   "Cannot read from stream",
   "Cannot write to stream",
   "Packet MAC failed",
@@ -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;
     }
   }