diff options
author | Jukka Rissanen <jukka.rissanen@linux.intel.com> | 2012-03-20 12:37:57 +0200 |
---|---|---|
committer | Patrik Flykt <patrik.flykt@linux.intel.com> | 2012-03-27 12:54:35 +0300 |
commit | 18fdec1d5e9419620d51619fc5614f0c90bfecd7 (patch) | |
tree | 7849244b78dece221cce01f6ab405efb6b0efccb | |
parent | 791e46222bd1d67bc21182a930a119a910a86c6f (diff) | |
download | connman-18fdec1d5e9419620d51619fc5614f0c90bfecd7.tar.gz connman-18fdec1d5e9419620d51619fc5614f0c90bfecd7.tar.bz2 connman-18fdec1d5e9419620d51619fc5614f0c90bfecd7.zip |
vpn: Unref provider properly
The provider can be unreffed in vpn_died() or in vpn_disconnect().
We must do the unref only once.
-rw-r--r-- | plugins/vpn.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/vpn.c b/plugins/vpn.c index 7a35f7a4..e41a3742 100644 --- a/plugins/vpn.c +++ b/plugins/vpn.c @@ -134,8 +134,12 @@ void vpn_died(struct connman_task *task, int exit_code, void *user_data) stop_vpn(provider); connman_provider_set_data(provider, NULL); - connman_provider_unref(provider); - connman_rtnl_remove_watch(data->watch); + + if (data->watch != 0) { + connman_provider_unref(provider); + connman_rtnl_remove_watch(data->watch); + data->watch = 0; + } vpn_exit: if (state != VPN_STATE_READY && state != VPN_STATE_DISCONNECT) { |