From 7df31ae8978fd719646384ba1889fd69a038a45c Mon Sep 17 00:00:00 2001 From: Soeren Apel Date: Sat, 1 Aug 2015 21:41:32 +0200 Subject: [PATCH] output/srzip: Prevent memory leak in case filename is empty --- src/output/srzip.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/output/srzip.c b/src/output/srzip.c index 690736c8..409421cb 100644 --- a/src/output/srzip.c +++ b/src/output/srzip.c @@ -41,14 +41,14 @@ static int init(struct sr_output *o, GHashTable *options) (void)options; - outc = g_malloc0(sizeof(struct out_context)); - o->priv = outc; - if (strlen(o->filename) == 0) { sr_info("srzip output module requires a file name, cannot save."); return SR_ERR_ARG; } + + outc = g_malloc0(sizeof(struct out_context)); outc->filename = g_strdup(o->filename); + o->priv = outc; return SR_OK; }