diff options
author | Ted Gould <ted@canonical.com> | 2009-08-27 08:34:46 -0500 |
---|---|---|
committer | Ted Gould <ted@canonical.com> | 2009-08-27 08:34:46 -0500 |
commit | 084decde9945791e7116a16876aabb1788049616 (patch) | |
tree | b9d051a60c717307b0931a730602764d56c6b269 | |
parent | 287122c696ddf0cc0e00a0f7e39663024aaf5e6d (diff) | |
download | libdbusmenu-084decde9945791e7116a16876aabb1788049616.tar.gz libdbusmenu-084decde9945791e7116a16876aabb1788049616.tar.bz2 libdbusmenu-084decde9945791e7116a16876aabb1788049616.zip |
Check the return of g_new0 for NULL. Comment by Neil.
-rw-r--r-- | libdbusmenu-glib/client.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/libdbusmenu-glib/client.c b/libdbusmenu-glib/client.c index 9004f55..92c7aa9 100644 --- a/libdbusmenu-glib/client.c +++ b/libdbusmenu-glib/client.c @@ -622,11 +622,15 @@ parse_layout_xml(DbusmenuClient * client, xmlNodePtr node, DbusmenuMenuitem * it /* Get the properties queued up for this item */ /* Not happy about this, but I need these :( */ newItemPropData * propdata = g_new0(newItemPropData, 1); - propdata->client = client; - propdata->item = item; - propdata->parent = parent; - - org_freedesktop_dbusmenu_get_properties_async(proxy, id, menuitem_get_properties_new_cb, propdata); + if (propdata != NULL) { + propdata->client = client; + propdata->item = item; + propdata->parent = parent; + + org_freedesktop_dbusmenu_get_properties_async(proxy, id, menuitem_get_properties_new_cb, propdata); + } else { + g_warning("Unable to allocate memory to get properties for menuitem. This menuitem will never be realized."); + } } xmlNodePtr children; |