[glib] gtimezone: Fix two minor leaks in zone_info_unix()
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gtimezone: Fix two minor leaks in zone_info_unix()
- Date: Wed, 16 May 2018 10:30:22 +0000 (UTC)
commit 12de4748082f542f32bbf9c31cf44b9c1ee8279a
Author: Philip Withnall <withnall endlessm com>
Date: Wed May 16 11:27:25 2018 +0100
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
(https://gitlab.gnome.org/GNOME/glib/commit/8945227743a26a4fe6966baaf082dd6516e8a03c#note_111254).
Thanks!
Signed-off-by: Philip Withnall <withnall endlessm com>
Reviewed-by: nobody
glib/gtimezone.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/glib/gtimezone.c b/glib/gtimezone.c
index 896c117bc..72a4916ad 100644
--- a/glib/gtimezone.c
+++ b/glib/gtimezone.c
@@ -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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]