[glib] MacOS: gosxappinfo.c Fix some memory leaks. Fix failure condition.
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] MacOS: gosxappinfo.c Fix some memory leaks. Fix failure condition.
- Date: Tue, 17 Oct 2017 13:10:55 +0000 (UTC)
commit 37c0610b4d6b43fc9aea7983d1e82be7fdae6660
Author: Friedrich Beckmann <friedrich beckmann gmx de>
Date: Mon Oct 16 13:48:51 2017 +0200
MacOS: gosxappinfo.c Fix some memory leaks. Fix failure condition.
Ensure that the debug call won't crash if create_cstr_from_cfstring
returns NULL, fix the leak of that CFArrayRef, and make explicit the
failure condition of LSFindApplicationForInfo.
https://bugzilla.gnome.org/show_bug.cgi?id=788936
gio/gosxappinfo.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
---
diff --git a/gio/gosxappinfo.c b/gio/gosxappinfo.c
index 50c1ec3..463b2da 100644
--- a/gio/gosxappinfo.c
+++ b/gio/gosxappinfo.c
@@ -335,13 +335,18 @@ get_bundle_for_id (CFStringRef bundle_id)
}
else
#else
- if (LSFindApplicationForInfo (kLSUnknownCreator, bundle_id, NULL, NULL, &app_url))
+ if (LSFindApplicationForInfo (kLSUnknownCreator, bundle_id, NULL, NULL, &app_url) ==
kLSApplicationNotFoundErr)
#endif
{
#ifdef G_ENABLE_DEBUG /* This can fail often, no reason to alloc strings */
gchar *id_str = create_cstr_from_cfstring (bundle_id);
- g_debug ("Application not found for id \"%s\".", id_str);
- g_free (id_str);
+ if (id_str)
+ {
+ g_debug ("Application not found for id \"%s\".", id_str);
+ g_free (id_str);
+ }
+ else
+ g_debug ("Application not found for unconvertable bundle id.");
#endif
return NULL;
}
@@ -601,7 +606,7 @@ g_osx_app_info_get_all_for_scheme (const char *cscheme)
info = G_APP_INFO (g_osx_app_info_new (bundle));
info_list = g_list_append (info_list, info);
}
-
+ CFRelease (bundle_list);
return info_list;
}
@@ -646,7 +651,7 @@ g_app_info_get_all_for_type (const char *content_type)
info = G_APP_INFO (g_osx_app_info_new (bundle));
info_list = g_list_append (info_list, info);
}
-
+ CFRelease (bundle_list);
return info_list;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]