dbus: Verify dbus_message_new_method_return() return value before use

This commit is contained in:
Jouni Malinen 2009-12-29 23:46:50 +02:00
parent 8e56d18993
commit ba96adb65f

View file

@ -589,7 +589,7 @@ static DBusMessage * introspect(DBusMessage *message,
struct wpa_dbus_object_desc *obj_dsc)
{
DBusMessage *reply = NULL;
DBusMessage *reply;
struct interfaces *ifaces, *tmp;
struct wpa_dbus_signal_desc *signal_dsc;
struct wpa_dbus_method_desc *method_dsc;
@ -603,9 +603,6 @@ static DBusMessage * introspect(DBusMessage *message,
xmlNodePtr method_node = NULL, signal_node = NULL;
xmlNodePtr property_node = NULL, arg_node = NULL;
/* Create and initialize the return message */
reply = dbus_message_new_method_return(message);
/* root node and dtd */
doc = xmlNewDoc(BAD_CAST "1.0");
root_node = xmlNewNode(NULL, BAD_CAST "node");
@ -809,6 +806,12 @@ static DBusMessage * introspect(DBusMessage *message,
os_free(tmp);
}
reply = dbus_message_new_method_return(message);
if (reply == NULL) {
xmlFree(intro_str);
return NULL;
}
dbus_message_append_args(reply, DBUS_TYPE_STRING, &intro_str,
DBUS_TYPE_INVALID);