[PATCH 2/3] wifi: Check peer_service user_data before invoking cb

2014-09-17 Thread Eduardo Abinader
A check was added, due to the occurrence of peer service
registration without callback. Such scenarios takes place,
when a previous peer service was registered with a proper
callback, on a distinct interface.
---
 plugins/wifi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index f16c3fe..45d88b8 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -376,10 +376,10 @@ static void register_peer_service_cb(int result,
wifi-servicing++;
}
 
-   if (reg_data-callback)
+   if (reg_data  reg_data-callback) {
reg_data-callback(result, reg_data-user_data);
-
-   g_free(reg_data);
+   g_free(reg_data);
+   }
 }
 
 static GSupplicantP2PServiceParams *fill_in_peer_service_params(
-- 
1.9.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH 2/3] wifi: Check peer_service user_data before invoking cb

2014-09-17 Thread Eduardo Abinader
A check was added, due to the occurrence of peer service
registration without callback. Such scenarios takes place,
when a previous peer service was registered with a proper
callback, on a distinct interface.
---
 plugins/wifi.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/plugins/wifi.c b/plugins/wifi.c
index f16c3fe..45d88b8 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -376,10 +376,10 @@ static void register_peer_service_cb(int result,
wifi-servicing++;
}
 
-   if (reg_data-callback)
+   if (reg_data  reg_data-callback) {
reg_data-callback(result, reg_data-user_data);
-
-   g_free(reg_data);
+   g_free(reg_data);
+   }
 }
 
 static GSupplicantP2PServiceParams *fill_in_peer_service_params(
-- 
1.9.1

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman