From: Soeren Apel Date: Sat, 1 Aug 2015 19:41:32 +0000 (+0200) Subject: output/srzip: Prevent memory leak in case filename is empty X-Git-Tag: libsigrok-0.4.0~447 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=7df31ae8978fd719646384ba1889fd69a038a45c;p=libsigrok.git output/srzip: Prevent memory leak in case filename is empty --- 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; }