From: Eric Leblond Date: Tue, 26 May 2015 10:02:49 +0000 (+0200) Subject: util-logopenfile: cleaner free function X-Git-Tag: suricata-3.0RC1~45 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c5d939834ffbecc9cc7cefbed1657b4412ccd95d;p=thirdparty%2Fsuricata.git util-logopenfile: cleaner free function --- 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