about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorWill Song <incertia9474@gmail.com>2015-11-24 18:19:02 -0600
committerWill Song <incertia9474@gmail.com>2015-11-24 18:19:02 -0600
commite945347f5242c496d9003a6af45adf716b707eaf (patch)
tree029dfc4c55b90f1f98acd49a0aa66d1d913940b0
parentd8022a9f208c238d9f2bdca5ebad1604683f4273 (diff)
downloadprofani-tty-e945347f5242c496d9003a6af45adf716b707eaf.tar.gz
free fname as soon as we are done with it (also prevents a memory leak)
-rw-r--r--src/command/commands.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index 286b0afe..25ba0d1e 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -841,6 +841,7 @@ cmd_export(ProfWin *window, const char *const command, gchar **args)
         }
 
         fd = open(fname->str, O_WRONLY | O_CREAT, 00600);
+        g_string_free(fname, TRUE);
 
         if(-1 == fd) {
             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);
         close(fd);
-        g_string_free(fname, TRUE);
         return TRUE;
 write_error:
         cons_show("error: write failed: %s", strerror(errno));