mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-31 23:26:20 +00:00
free fname as soon as we are done with it (also prevents a memory leak)
This commit is contained in:
@@ -841,6 +841,7 @@ cmd_export(ProfWin *window, const char *const command, gchar **args)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fd = open(fname->str, O_WRONLY | O_CREAT, 00600);
|
fd = open(fname->str, O_WRONLY | O_CREAT, 00600);
|
||||||
|
g_string_free(fname, TRUE);
|
||||||
|
|
||||||
if(-1 == fd) {
|
if(-1 == fd) {
|
||||||
cons_show("error: cannot open %s: %s", args[0], strerror(errno));
|
cons_show("error: cannot open %s: %s", args[0], strerror(errno));
|
||||||
@@ -877,7 +878,6 @@ cmd_export(ProfWin *window, const char *const command, gchar **args)
|
|||||||
|
|
||||||
g_slist_free(list);
|
g_slist_free(list);
|
||||||
close(fd);
|
close(fd);
|
||||||
g_string_free(fname, TRUE);
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
write_error:
|
write_error:
|
||||||
cons_show("error: write failed: %s", strerror(errno));
|
cons_show("error: write failed: %s", strerror(errno));
|
||||||
|
|||||||
Reference in New Issue
Block a user