girepository: Fix leak in write_field_info

Unref type before reusing it. Found by Coverity.

https://bugzilla.redhat.com/show_bug.cgi?id=1938731
This commit is contained in:
David King 2021-05-20 12:35:37 +01:00 committed by Emmanuele Bassi
parent 4e3ab408f1
commit 16b064bea9

View File

@ -423,6 +423,7 @@ write_field_info (const gchar *namespace,
if (branch) if (branch)
{ {
xml_printf (file, " branch=\""); xml_printf (file, " branch=\"");
g_base_info_unref ((GIBaseInfo *)type);
type = g_constant_info_get_type (branch); type = g_constant_info_get_type (branch);
g_constant_info_get_value (branch, &value); g_constant_info_get_value (branch, &value);
write_constant_value (namespace, type, &value, file); write_constant_value (namespace, type, &value, file);