]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
host: don't destroy reference counter
authorEric Leblond <eric@regit.org>
Tue, 27 Nov 2012 09:01:12 +0000 (10:01 +0100)
committerEric Leblond <eric@regit.org>
Tue, 27 Nov 2012 12:45:57 +0000 (13:45 +0100)
The reference counter should not be destroyed in HostClearMemory()
as the host can be reused directly (without going through Init
function).

src/host.c

index 7cf18dcdf748be81fb755dc7b6049422db94c815..63b3ef3cfe42230f02297cf555381fdc41ab826d 100644 (file)
@@ -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