]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
util-logopenfile: cleaner free function
authorEric Leblond <eric@regit.org>
Tue, 26 May 2015 10:02:49 +0000 (12:02 +0200)
committerVictor Julien <victor@inliniac.net>
Thu, 22 Oct 2015 08:01:05 +0000 (10:01 +0200)
src/util-logopenfile.c

index fe22ed538db1cdcb8fcb5db794cc8549ea0b55b4..91a1400ee550735f648ede18584e5b276ffb2764 100644 (file)
@@ -495,12 +495,17 @@ int LogFileFreeCtx(LogFileCtx *lf_ctx)
     }
 
 #ifdef HAVE_LIBHIREDIS
-    if (lf_ctx->type == LOGFILE_TYPE_REDIS && lf_ctx->redis) {
-        redisFree(lf_ctx->redis);
-        SCFree(lf_ctx->redis_setup.server);
-        SCFree(lf_ctx->redis_setup.command);
-        SCFree(lf_ctx->redis_setup.key);
-        SCFree(lf_ctx->redis_setup.sensor_name);
+    if (lf_ctx->type == LOGFILE_TYPE_REDIS) {
+        if (lf_ctx->redis)
+            redisFree(lf_ctx->redis);
+        if (lf_ctx->redis_setup.server)
+            SCFree(lf_ctx->redis_setup.server);
+        if (lf_ctx->redis_setup.command)
+            SCFree(lf_ctx->redis_setup.command);
+        if (lf_ctx->redis_setup.key)
+            SCFree(lf_ctx->redis_setup.key);
+        if (lf_ctx->redis_setup.sensor_name)
+            SCFree(lf_ctx->redis_setup.sensor_name);
     }
 #endif