fname would have been leaked if we failed to get a file_handler.
Also make sure we always create a new fname strbuf even without
a output_dir present to fix a potential unbalance between creating
and freeing.
CID: 1378112
const char *filename = file_name;
Eina_Strbuf *fname = NULL;
+ fname = eina_strbuf_new();
+
if (output_dir)
{
- fname = eina_strbuf_new();
eina_strbuf_append_printf(fname, "%s/%s", output_dir, file_name);
filename = eina_strbuf_string_get(fname);
}
if (!file_handler)
{
printf("Error to write file: %s\n", file_name);
+ eina_strbuf_free(fname);
return EINA_FALSE;
}