From 2650c6744a4595fe4db954a57d35aa9c1ebaa8f3 Mon Sep 17 00:00:00 2001 From: lahiker42 Date: Wed, 17 Dec 2008 02:40:32 +0000 Subject: [PATCH] Fix memory leak when used with uknown fields. git-svn-id: https://protobuf-c.googlecode.com/svn/trunk@91 00440858-1255-0410-a3e6-75ea37f81c3a --- src/google/protobuf-c/protobuf-c.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/google/protobuf-c/protobuf-c.c b/src/google/protobuf-c/protobuf-c.c index de2395e..4405fd6 100644 --- a/src/google/protobuf-c/protobuf-c.c +++ b/src/google/protobuf-c/protobuf-c.c @@ -1592,6 +1592,12 @@ protobuf_c_message_free_unpacked (ProtobufCMessage *message, protobuf_c_message_free_unpacked (sm, allocator); } } + + for (f = 0; f < message->n_unknown_fields; f++) + FREE (allocator, message->unknown_fields[f].data); + if (message->unknown_fields != NULL) + FREE (allocator, message->unknown_fields); + FREE (allocator, message); }