mirror of
https://github.com/protobuf-c/protobuf-c.git
synced 2024-12-28 14:48:18 +08:00
protobuf-c/protobuf-c.c: fix a logic error when a failed merge would
leave a dangling pointer to the parsed submessage
This commit is contained in:
parent
7b665e9ce4
commit
746ea972bc
@ -1943,12 +1943,10 @@ parse_required_member (ScannedMember *scanned_member,
|
|||||||
merge_successful = merge_messages (*pmessage, subm, allocator);
|
merge_successful = merge_messages (*pmessage, subm, allocator);
|
||||||
/* Delete the previous message */
|
/* Delete the previous message */
|
||||||
protobuf_c_message_free_unpacked (*pmessage, allocator);
|
protobuf_c_message_free_unpacked (*pmessage, allocator);
|
||||||
*pmessage = NULL;
|
|
||||||
}
|
}
|
||||||
|
*pmessage = subm;
|
||||||
if (subm == NULL || !merge_successful)
|
if (subm == NULL || !merge_successful)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
*pmessage = subm;
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user