]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
pcap: ref config according to threads count
authorEric Leblond <eric@regit.org>
Mon, 5 Nov 2012 21:08:40 +0000 (22:08 +0100)
committerVictor Julien <victor@inliniac.net>
Wed, 7 Nov 2012 15:05:18 +0000 (16:05 +0100)
src/runmode-pcap.c

index afd20ef4b46bd736ff8d68c8e18e0dc0f1bc817e..aeefbf267c4d96f849d5f3d21626161aa05f9946 100644 (file)
@@ -119,7 +119,6 @@ void *ParsePcapConfig(const char *iface)
     }
 
     SC_ATOMIC_INIT(aconf->ref);
-    (void) SC_ATOMIC_ADD(aconf->ref, 1);
     aconf->DerefFunc = PcapDerefConfig;
     aconf->threads = 1;
 
@@ -148,6 +147,8 @@ void *ParsePcapConfig(const char *iface)
     if (aconf->threads == 0) {
         aconf->threads = 1;
     }
+    (void) SC_ATOMIC_ADD(aconf->ref, aconf->threads);
+
     if (aconf->buffer_size == 0) {
         const char *s_limit = ConfNodeLookupChildValue(if_root, "buffer-size");
         if (s_limit != NULL) {