mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
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
This commit is contained in:
parent
2bd423c54c
commit
37c0610b4d
@ -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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user