diff --git a/tests/hwsim/test_dbus.py b/tests/hwsim/test_dbus.py index 28fa7197e..2c59d7fb7 100644 --- a/tests/hwsim/test_dbus.py +++ b/tests/hwsim/test_dbus.py @@ -3541,13 +3541,16 @@ def test_dbus_p2p_service_discovery(dev, apdev): if "InvalidArgs" not in str(e): raise Exception("Unexpected error message for invalid ServiceDiscoveryRequest(): " + str(e)) - args = {'foo': 'bar'} - try: - p2p.ServiceDiscoveryResponse(dbus.Dictionary(args, signature='sv')) - raise Exception("Invalid ServiceDiscoveryResponse accepted") - except dbus.exceptions.DBusException as e: - if "InvalidArgs" not in str(e): - raise Exception("Unexpected error message for invalid ServiceDiscoveryResponse(): " + str(e)) + tests = [{'foo': 'bar'}, + {'tlvs': dbus.ByteArray(b"\x02\x00\x00\x01"), + 'bar': 'foo'}] + for args in tests: + try: + p2p.ServiceDiscoveryResponse(dbus.Dictionary(args, signature='sv')) + raise Exception("Invalid ServiceDiscoveryResponse accepted") + except dbus.exceptions.DBusException as e: + if "InvalidArgs" not in str(e): + raise Exception("Unexpected error message for invalid ServiceDiscoveryResponse(): " + str(e)) def test_dbus_p2p_service_discovery_query(dev, apdev): """D-Bus P2P service discovery query""" diff --git a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c index 53495f2c3..d001c0154 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers_p2p.c +++ b/wpa_supplicant/dbus/dbus_new_handlers_p2p.c @@ -3024,8 +3024,8 @@ DBusMessage * wpas_dbus_handler_p2p_service_sd_res( goto error; wpas_p2p_sd_response(wpa_s, freq, addr, (u8) dlg_tok, tlv); - wpabuf_free(tlv); out: + wpabuf_free(tlv); os_free(peer_object_path); return reply; error_clear: