Browse Source

D-Bus: Use NoMemory error message from CreateInterface

Try to be a bit more consistent by using NoMemory instead of InvalidArgs
if os_strdup() fails in the CreateInterface handler.

Signed-off-by: Jouni Malinen <j@w1.fi>
Jouni Malinen 10 years ago
parent
commit
a354bcc886
1 changed files with 7 additions and 4 deletions
  1. 7 4
      wpa_supplicant/dbus/dbus_new_handlers.c

+ 7 - 4
wpa_supplicant/dbus/dbus_new_handlers.c

@@ -537,28 +537,28 @@ DBusMessage * wpas_dbus_handler_create_interface(DBusMessage *message,
 			driver = os_strdup(entry.str_value);
 			wpa_dbus_dict_entry_clear(&entry);
 			if (driver == NULL)
-				goto error;
+				goto oom;
 		} else if (os_strcmp(entry.key, "Ifname") == 0 &&
 			   entry.type == DBUS_TYPE_STRING) {
 			os_free(ifname);
 			ifname = os_strdup(entry.str_value);
 			wpa_dbus_dict_entry_clear(&entry);
 			if (ifname == NULL)
-				goto error;
+				goto oom;
 		} else if (os_strcmp(entry.key, "ConfigFile") == 0 &&
 			   entry.type == DBUS_TYPE_STRING) {
 			os_free(confname);
 			confname = os_strdup(entry.str_value);
 			wpa_dbus_dict_entry_clear(&entry);
 			if (confname == NULL)
-				goto error;
+				goto oom;
 		} else if (os_strcmp(entry.key, "BridgeIfname") == 0 &&
 			   entry.type == DBUS_TYPE_STRING) {
 			os_free(bridge_ifname);
 			bridge_ifname = os_strdup(entry.str_value);
 			wpa_dbus_dict_entry_clear(&entry);
 			if (bridge_ifname == NULL)
-				goto error;
+				goto oom;
 		} else {
 			wpa_dbus_dict_entry_clear(&entry);
 			goto error;
@@ -610,6 +610,9 @@ out:
 error:
 	reply = wpas_dbus_error_invalid_args(message, NULL);
 	goto out;
+oom:
+	reply = wpas_dbus_error_no_memory(message);
+	goto out;
 }