provider: Remove provider from the hash properly
authorJukka Rissanen <jukka.rissanen@linux.intel.com>
Thu, 19 Jan 2012 14:31:44 +0000 (16:31 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Fri, 20 Jan 2012 01:10:19 +0000 (02:10 +0100)
We must not just do connman_provider_unref(provider) as that will
leave the provider to the provider_hash and we will get free memory
access error. We can just remove the provider from the hash and
that will unref the provider automagically.

src/provider.c

index 0bac230..f0a91e8 100644 (file)
@@ -668,7 +668,7 @@ failed:
 unref:
        DBG("can not connect, delete provider");
 
-       connman_provider_unref(provider);
+       g_hash_table_remove(provider_hash, provider->identifier);
 
        return err;
 }