dbus: Fix potential memory leak with unexpected p2p_find calls
authorJouni Malinen <j@w1.fi>
Sun, 16 Oct 2011 10:19:33 +0000 (13:19 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 16 Oct 2011 10:19:33 +0000 (13:19 +0300)
Should the RequestedDeviceTypes entry show up multiple times, the
previously allocated buffer would have been leaked.

wpa_supplicant/dbus/dbus_new_handlers_p2p.c

index 0ab7553..f2c5a18 100644 (file)
@@ -101,6 +101,7 @@ DBusMessage * wpas_dbus_handler_p2p_find(DBusMessage *message,
                            (entry.array_type != WPAS_DBUS_TYPE_BINARRAY))
                                goto error_clear;
 
+                       os_free(req_dev_types);
                        req_dev_types =
                                os_malloc(WPS_DEV_TYPE_LEN * entry.array_len);
                        if (!req_dev_types)