output/srzip: Prevent memory leak in case filename is empty

This commit is contained in:
Soeren Apel 2015-08-01 21:41:32 +02:00 committed by Uwe Hermann
parent bd7b83cf63
commit 7df31ae897
1 changed files with 3 additions and 3 deletions

View File

@ -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;
}