From 746ea972bc595068db2c357114707b7c649c6a68 Mon Sep 17 00:00:00 2001 From: Ilya Lipnitskiy Date: Fri, 22 Nov 2013 17:35:07 -0800 Subject: [PATCH] protobuf-c/protobuf-c.c: fix a logic error when a failed merge would leave a dangling pointer to the parsed submessage --- protobuf-c/protobuf-c.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/protobuf-c/protobuf-c.c b/protobuf-c/protobuf-c.c index 1519c37..8f7c12a 100644 --- a/protobuf-c/protobuf-c.c +++ b/protobuf-c/protobuf-c.c @@ -1943,12 +1943,10 @@ parse_required_member (ScannedMember *scanned_member, merge_successful = merge_messages (*pmessage, subm, allocator); /* Delete the previous message */ protobuf_c_message_free_unpacked (*pmessage, allocator); - *pmessage = NULL; } + *pmessage = subm; if (subm == NULL || !merge_successful) return 0; - - *pmessage = subm; return 1; } }