kernel-pfkey: Add sanity check when deleting policies
authorTobias Brunner <tobias@strongswan.org>
Wed, 24 Jul 2013 09:11:25 +0000 (11:11 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 24 Jul 2013 14:17:22 +0000 (16:17 +0200)
src/libhydra/plugins/kernel_pfkey/kernel_pfkey_ipsec.c

index 214feac..668c581 100644 (file)
@@ -2543,6 +2543,11 @@ METHOD(kernel_ipsec_t, del_policy, status_t,
                first = FALSE;
        }
        enumerator->destroy(enumerator);
+       if (!to_remove)
+       {       /* sanity check */
+               this->mutex->unlock(this->mutex);
+               return SUCCESS;
+       }
        policy->used_by->remove(policy->used_by, to_remove, NULL);
        mapping = to_remove;