From: Eric Leblond Date: Tue, 27 Nov 2012 09:01:12 +0000 (+0100) Subject: host: don't destroy reference counter X-Git-Tag: suricata-1.4rc1~17 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d9eaa0d3405728cf5ed77c1ac46bff37cbc1bb58;p=thirdparty%2Fsuricata.git host: don't destroy reference counter The reference counter should not be destroyed in HostClearMemory() as the host can be reused directly (without going through Init function). --- diff --git a/src/host.c b/src/host.c index 7cf18dcdf7..63b3ef3cfe 100644 --- a/src/host.c +++ b/src/host.c @@ -79,6 +79,7 @@ void HostFree(Host *h) { if (h != NULL) { HostClearMemory(h); + SC_ATOMIC_DESTROY(h->use_cnt); SCMutexDestroy(&h->m); SCFree(h); (void) SC_ATOMIC_SUB(host_memuse, sizeof(Host)); @@ -112,7 +113,6 @@ void HostClearMemory(Host *h) { SCFree(h->iprep); h->iprep = NULL; } - SC_ATOMIC_DESTROY(h->use_cnt); } #define HOST_DEFAULT_HASHSIZE 4096