This patch frees peer_params->path and peer_params->wps_pin also when
peer_params is freed. Both peer_params->path and peer_params->wps_pin
are allocated memory using g_strdup() and needs to be freed when
g_supplicant_interface_p2p_connect() return is less than 0.
---
 plugins/wifi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index 587dee2..513e577 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -356,8 +356,11 @@ static int peer_connect(struct connman_peer *peer,
                wifi->pending_peer = connman_peer_ref(peer);
                wifi->peer = gs_peer;
                wifi->p2p_connecting = true;
-       } else if (ret < 0)
+       } else if (ret < 0) {
+               g_free(peer_params->path);
+               g_free(peer_params->wps_pin);
                g_free(peer_params);
+       }
 
        return ret;
 }
-- 
1.9.1

_______________________________________________
connman mailing list
[email protected]
https://lists.connman.net/mailman/listinfo/connman

Reply via email to