]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
iprep: improve error checking of path handling
authorVictor Julien <victor@inliniac.net>
Thu, 22 Nov 2018 09:34:49 +0000 (10:34 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 26 Nov 2018 15:33:37 +0000 (16:33 +0100)
src/reputation.c

index a364c7c01f7ea619b6b073f17146586aac3abc39..58de88c5352149681b2b99baab1002012fe8b6a1 100644 (file)
@@ -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);
         }
     }