Free list after removing the last local credential set, fixes a leak report
authorMartin Willi <martin@revosec.ch>
Tue, 13 Dec 2011 10:37:02 +0000 (11:37 +0100)
committerMartin Willi <martin@revosec.ch>
Tue, 20 Mar 2012 16:31:19 +0000 (17:31 +0100)
src/libstrongswan/credentials/credential_manager.c

index 27b97ea..4c31040 100644 (file)
@@ -393,6 +393,11 @@ METHOD(credential_manager_t, remove_local_set, void,
 
        sets = this->local_sets->get(this->local_sets);
        sets->remove(sets, set, NULL);
+       if (sets->get_count(sets) == 0)
+       {
+               this->local_sets->set(this->local_sets, NULL);
+               sets->destroy(sets);
+       }
 }
 
 METHOD(credential_manager_t, cache_cert, void,