From: Victor Julien Date: Thu, 22 Nov 2018 09:34:49 +0000 (+0100) Subject: iprep: improve error checking of path handling X-Git-Tag: suricata-4.1.1~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5740c79b93d420aea2ce644a2ad04fe7bffd527e;p=thirdparty%2Fsuricata.git iprep: improve error checking of path handling --- diff --git a/src/reputation.c b/src/reputation.c index a364c7c01f..58de88c535 100644 --- a/src/reputation.c +++ b/src/reputation.c @@ -580,8 +580,6 @@ int SRepInit(DetectEngineCtx *de_ctx) { ConfNode *files; ConfNode *file = NULL; - int r = 0; - char *sfile = NULL; const char *filename = NULL; int init = 0; int i = 0; @@ -633,19 +631,21 @@ int SRepInit(DetectEngineCtx *de_ctx) de_ctx->srep_version = SRepIncrVersion(); SCLogDebug("Reputation version %u", de_ctx->srep_version); - /* ok, let's load signature files from the general config */ + /* ok, let's load reputation files from the general config */ if (files != NULL) { TAILQ_FOREACH(file, &files->head, next) { - sfile = SRepCompleteFilePath(file->val); - SCLogInfo("Loading reputation file: %s", sfile); - - r = SRepLoadFile(cidr_ctx, sfile); - if (r < 0){ - if (de_ctx->failure_fatal == 1) { - exit(EXIT_FAILURE); + char *sfile = SRepCompleteFilePath(file->val); + if (sfile) { + SCLogInfo("Loading reputation file: %s", sfile); + + int r = SRepLoadFile(cidr_ctx, sfile); + if (r < 0){ + if (de_ctx->failure_fatal == 1) { + exit(EXIT_FAILURE); + } } + SCFree(sfile); } - SCFree(sfile); } }