From 7dc4b164a8d0c9bbb88c5cc81f4b7dd5c8db9c13 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 20 Dec 2010 11:43:36 +0100 Subject: [PATCH] Fix a clang warning in unittest DetectUriSigTest12. --- src/detect-uricontent.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/detect-uricontent.c b/src/detect-uricontent.c index 7336b00097..062c068770 100644 --- a/src/detect-uricontent.c +++ b/src/detect-uricontent.c @@ -1764,7 +1764,7 @@ int DetectUriSigTest12(void) DetectEngineCtx *de_ctx = NULL; DetectContentData *ud = 0; Signature *s = NULL; - int result = 1; + int result = 0; de_ctx = DetectEngineCtxInit(); if (de_ctx == NULL) @@ -1775,21 +1775,19 @@ int DetectUriSigTest12(void) "alert udp any any -> any any " "(msg:\"test\"; uricontent: !\"boo\"; sid:238012;)"); if (de_ctx->sig_list == NULL) { - printf("de_ctx->sig_list == NULL\n"); - result = 0; + printf("de_ctx->sig_list == NULL: "); goto end; } - if (s->sm_lists_tail[DETECT_SM_LIST_UMATCH] == NULL && s->sm_lists_tail[DETECT_SM_LIST_UMATCH]->ctx) { - printf("de_ctx->pmatch_tail == NULL && de_ctx->pmatch_tail->ctx\n"); - result = 0; + if (s->sm_lists_tail[DETECT_SM_LIST_UMATCH] == NULL || s->sm_lists_tail[DETECT_SM_LIST_UMATCH]->ctx == NULL) { + printf("de_ctx->pmatch_tail == NULL && de_ctx->pmatch_tail->ctx == NULL: "); goto end; } ud = (DetectContentData *)s->sm_lists_tail[DETECT_SM_LIST_UMATCH]->ctx; result = (strncmp("boo", (char *)ud->content, ud->content_len) == 0); - end: +end: SigGroupCleanup(de_ctx); SigCleanSignatures(de_ctx); DetectEngineCtxFree(de_ctx);