[PATCH] vpn: Cleanup properly if vpn connect fails

Jukka Rissanen jukka.rissanen at linux.intel.com
Mon Nov 26 02:16:32 PST 2012


Make sure that user callback data is cleared correctly
if vpn connect attempt fails.
---
 plugins/vpn.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/plugins/vpn.c b/plugins/vpn.c
index 99b59c2..2a974d6 100644
--- a/plugins/vpn.c
+++ b/plugins/vpn.c
@@ -454,7 +454,8 @@ static void connect_reply(DBusPendingCall *call, void *user_data)
 {
 	DBusMessage *reply;
 	DBusError error;
-	struct config_create_data *cb_data = user_data;
+	struct connection_data *data = user_data;
+	struct config_create_data *cb_data = data->cb_data;
 
 	if (dbus_pending_call_get_completed(call) == FALSE)
 		return;
@@ -476,6 +477,7 @@ static void connect_reply(DBusPendingCall *call, void *user_data)
 				cb_data->callback(cb_data->message,
 						ECONNREFUSED, NULL);
 				free_config_cb_data(cb_data);
+				data->cb_data = NULL;
 			}
 			goto done;
 		}
@@ -526,7 +528,7 @@ static int connect_provider(struct connection_data *data, void *user_data)
 		cb_data->path = g_strdup(data->path);
 	}
 
-	dbus_pending_call_set_notify(call, connect_reply, cb_data, NULL);
+	dbus_pending_call_set_notify(call, connect_reply, data, NULL);
 
 	dbus_message_unref(message);
 
-- 
1.7.11.4




More information about the connman mailing list