]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
tm-threads: fix potential access to NULL pointer.
authorEric Leblond <eric@regit.org>
Tue, 9 Oct 2012 16:38:02 +0000 (18:38 +0200)
committerEric Leblond <eric@regit.org>
Mon, 19 Nov 2012 22:52:19 +0000 (23:52 +0100)
src/tm-threads.c

index 597c747ba6d5ba7695cac2c00e10c01ef583a332..4309b1749fc887b00743536e59c1b8461f26fe34 100644 (file)
@@ -1465,10 +1465,10 @@ ThreadVars *TmThreadCreateMgmtThread(char *name, void *(fn_p)(void *),
 
     tv = TmThreadCreate(name, NULL, NULL, NULL, NULL, "custom", fn_p, mucond);
 
-    TmThreadSetCPU(tv, MANAGEMENT_CPU_SET);
-
-    if (tv != NULL)
+    if (tv != NULL) {
         tv->type = TVT_MGMT;
+        TmThreadSetCPU(tv, MANAGEMENT_CPU_SET);
+    }
 
     return tv;
 }