gtimezone: Fix two minor leaks in zone_info_unix()

• A leak of filename on an error path
 • A leak of resolved_identifier if no out_identifier return location
   was provided

The latter was spotted by Peter Bloomfield
(8945227743 (note_111254)).
Thanks!

Signed-off-by: Philip Withnall <withnall@endlessm.com>
Reviewed-by: nobody
This commit is contained in:
Philip Withnall 2018-05-16 11:27:25 +01:00
parent a9fe62aa2c
commit 12de474808

View File

@ -457,9 +457,8 @@ zone_info_unix (const gchar *identifier,
else
{
/* Error */
if (out_identifier != NULL)
*out_identifier = NULL;
return NULL;
g_assert (resolved_identifier == NULL);
goto out;
}
}
else
@ -494,12 +493,16 @@ zone_info_unix (const gchar *identifier,
g_mapped_file_ref (file));
g_mapped_file_unref (file);
}
g_free (filename);
g_assert (resolved_identifier != NULL);
out:
if (out_identifier != NULL)
*out_identifier = g_steal_pointer (&resolved_identifier);
g_free (resolved_identifier);
g_free (filename);
return zoneinfo;
}