From f094523eb1d7996e52bc25099c38b4068f225858 Mon Sep 17 00:00:00 2001 From: Anoop Saldanha Date: Fri, 30 Jul 2010 12:32:50 +0530 Subject: [PATCH] clang fix - some minor fixes for unittests --- src/detect-parse.c | 4 ++++ src/detect-pcre.c | 2 +- src/detect.c | 2 +- src/util-threshold-config.c | 8 ++++---- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/detect-parse.c b/src/detect-parse.c index 3a2e634711..3350ca6c92 100644 --- a/src/detect-parse.c +++ b/src/detect-parse.c @@ -2067,6 +2067,8 @@ int SigParseTest09(void) { DetectEngineAppendSig(de_ctx, "alert tcp any any -> any any (msg:\"boo\"; sid:2; rev:1;)"); result &= (de_ctx->sig_list != NULL && de_ctx->sig_list->id == 2 && de_ctx->sig_list->rev == 2); + if (result == 0) + goto end; result &= (de_ctx->sig_list->next != NULL && de_ctx->sig_list->next->id == 1 && de_ctx->sig_list->next->rev == 6); if (result == 0) @@ -2075,6 +2077,8 @@ int SigParseTest09(void) { DetectEngineAppendSig(de_ctx, "alert tcp any any -> any any (msg:\"boo\"; sid:2; rev:4;)"); result &= (de_ctx->sig_list != NULL && de_ctx->sig_list->id == 2 && de_ctx->sig_list->rev == 4); + if (result == 0) + goto end; result &= (de_ctx->sig_list->next != NULL && de_ctx->sig_list->next->id == 1 && de_ctx->sig_list->next->rev == 6); if (result == 0) diff --git a/src/detect-pcre.c b/src/detect-pcre.c index 99efc701f7..fd20039838 100644 --- a/src/detect-pcre.c +++ b/src/detect-pcre.c @@ -1760,7 +1760,7 @@ static int DetectPcreTestSig01Real(int mpm_type) { TcpSession ssn; Packet *p = NULL; ThreadVars th_v; - DetectEngineThreadCtx *det_ctx; + DetectEngineThreadCtx *det_ctx = NULL; int result = 0; Flow f; diff --git a/src/detect.c b/src/detect.c index 5ea725983a..e0bb8fbeb0 100644 --- a/src/detect.c +++ b/src/detect.c @@ -5092,7 +5092,7 @@ int SigTest24IPV4Keyword(void) Packet p1, p2; ThreadVars th_v; - DetectEngineThreadCtx *det_ctx; + DetectEngineThreadCtx *det_ctx = NULL; int result = 0; uint8_t *buf = (uint8_t *)"GET /one/ HTTP/1.0\r\n" diff --git a/src/util-threshold-config.c b/src/util-threshold-config.c index f86f482ca9..10de306ebf 100644 --- a/src/util-threshold-config.c +++ b/src/util-threshold-config.c @@ -1271,7 +1271,7 @@ int SCThresholdConfTest09(void) Packet *p = UTHBuildPacket((uint8_t*)"lalala", 6, IPPROTO_TCP); ThreadVars th_v; - DetectEngineThreadCtx *det_ctx; + DetectEngineThreadCtx *det_ctx = NULL; int alerts = 0; memset(&th_v, 0, sizeof(th_v)); @@ -1364,7 +1364,7 @@ int SCThresholdConfTest10(void) Packet *p2 = UTHBuildPacketSrcDst((uint8_t*)"lalala", 6, IPPROTO_TCP, "172.26.0.1", "172.26.0.10"); ThreadVars th_v; - DetectEngineThreadCtx *det_ctx; + DetectEngineThreadCtx *det_ctx = NULL; int alerts = 0; memset(&th_v, 0, sizeof(th_v)); @@ -1459,7 +1459,7 @@ int SCThresholdConfTest11(void) Packet *p = UTHBuildPacket((uint8_t*)"lalala", 6, IPPROTO_TCP); ThreadVars th_v; - DetectEngineThreadCtx *det_ctx; + DetectEngineThreadCtx *det_ctx = NULL; int alerts10 = 0; int alerts11 = 0; int alerts12 = 0; @@ -1575,7 +1575,7 @@ int SCThresholdConfTest12(void) Packet *p = UTHBuildPacket((uint8_t*)"lalala", 6, IPPROTO_TCP); ThreadVars th_v; - DetectEngineThreadCtx *det_ctx; + DetectEngineThreadCtx *det_ctx = NULL; int alerts10 = 0; int alerts11 = 0; int alerts12 = 0;