The provider can be unreffed in vpn_died() or in vpn_disconnect().
We must do the unref only once.
stop_vpn(provider);
connman_provider_set_data(provider, NULL);
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) {
vpn_exit:
if (state != VPN_STATE_READY && state != VPN_STATE_DISCONNECT) {