mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-24 14:36:13 +01:00
girepository/girparser: Free the struct or union node if was not tracked
In case the node was pushed to a non-empty node stack, then we were not tracking it in the entries list, and so nothing was freeing it on destruction. As per this, once parsing is done, we can free it or we'd leak.
This commit is contained in:
parent
98dce8a1c6
commit
997d32e9cd
@ -3376,13 +3376,19 @@ state_switch_end_struct_or_union (GMarkupParseContext *context,
|
||||
const char *element_name,
|
||||
GError **error)
|
||||
{
|
||||
pop_node (ctx);
|
||||
GIIrNode *node = pop_node (ctx);
|
||||
|
||||
if (ctx->node_stack == NULL)
|
||||
{
|
||||
state_switch (ctx, STATE_NAMESPACE);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* In this case the node was not tracked by any other node, so we need
|
||||
* to free the node, or we'd leak.
|
||||
*/
|
||||
g_clear_pointer (&node, gi_ir_node_free);
|
||||
|
||||
if (CURRENT_NODE (ctx)->type == GI_IR_NODE_STRUCT)
|
||||
state_switch (ctx, STATE_STRUCT);
|
||||
else if (CURRENT_NODE (ctx)->type == GI_IR_NODE_UNION)
|
||||
|
Loading…
Reference in New Issue
Block a user