From: Andreas Steffen Date: Thu, 29 Apr 2010 05:28:51 +0000 (+0200) Subject: do not destroy whack_attr if it hasn't been initialized X-Git-Tag: 4.4.0~16 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=916fd45709218e5a9fc59aa6fe4a1456d921f6b7;p=thirdparty%2Fstrongswan.git do not destroy whack_attr if it hasn't been initialized --- diff --git a/src/pluto/whack_attribute.c b/src/pluto/whack_attribute.c index 11692dc35d..6a12f0c098 100644 --- a/src/pluto/whack_attribute.c +++ b/src/pluto/whack_attribute.c @@ -216,12 +216,17 @@ METHOD(whack_attribute_t, create_lease_enumerator, enumerator_t*, */ void whack_attribute_finalize() { - private_whack_attribute_t *this = (private_whack_attribute_t*)whack_attr; - hydra->attributes->remove_provider(hydra->attributes, + private_whack_attribute_t *this; + + if (whack_attr) + { + this = (private_whack_attribute_t*)whack_attr; + hydra->attributes->remove_provider(hydra->attributes, &this->public.provider); - this->lock->destroy(this->lock); - this->pools->destroy_offset(this->pools, offsetof(mem_pool_t, destroy)); - free(this); + this->lock->destroy(this->lock); + this->pools->destroy_offset(this->pools, offsetof(mem_pool_t, destroy)); + free(this); + } } /**