From c5d939834ffbecc9cc7cefbed1657b4412ccd95d Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Tue, 26 May 2015 12:02:49 +0200 Subject: [PATCH] util-logopenfile: cleaner free function --- src/util-logopenfile.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/util-logopenfile.c b/src/util-logopenfile.c index fe22ed538d..91a1400ee5 100644 --- a/src/util-logopenfile.c +++ b/src/util-logopenfile.c @@ -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 -- 2.47.2