diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py index 2c2a2e44a..28fa7197e 100644 --- a/tests/hwsim/test_dbus.py +++ b/tests/hwsim/test_dbus.py @@ -3501,11 +3501,16 @@ def test_dbus_p2p_service_discovery(dev, apdev): if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid AddService(): " + str(e)) - args = {'service_type': 'upnp', - 'version': 0x10, - 'service': 'ssdp:foo'} - ref = p2p.ServiceDiscoveryRequest(args) - p2p.ServiceDiscoveryCancelRequest(ref) + tests= [{'service_type': 'upnp', + 'version': 0x10, + 'service': 'ssdp:foo'}, + {'service_type': 'upnp', + 'version': 0x10, + 'service': 'ssdp:bar', + 'tlv': dbus.ByteArray(b"\x02\x00\x00\x01")}] + for args in tests: + ref = p2p.ServiceDiscoveryRequest(args) + p2p.ServiceDiscoveryCancelRequest(ref) tests = [{'service_type': 'foo'}, {'foo': 'bar'}, diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c index 16b2caad6..53495f2c3 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c +++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c @@ -2952,7 +2952,6 @@ DBusMessage * wpas_dbus_handler_p2p_service_sd_req( if (tlv == NULL) goto error; ref = wpas_p2p_sd_request(wpa_s, addr, tlv); - wpabuf_free(tlv); } if (ref != 0) { @@ -2964,14 +2963,13 @@ DBusMessage * wpas_dbus_handler_p2p_service_sd_req( message, "Unable to send SD request"); } out: + wpabuf_free(tlv); os_free(service); os_free(peer_object_path); return reply; error_clear: wpa_dbus_dict_entry_clear(&entry); error: - if (tlv) - wpabuf_free(tlv); reply = wpas_dbus_error_invalid_args(message, NULL); goto out; }