diff --git a/src/terminal-options.c b/src/terminal-options.c
index 780d1082..2f7887a6 100644
--- a/src/terminal-options.c
+++ b/src/terminal-options.c
@@ -41,10 +41,10 @@
 
 static int verbosity = 1;
 
-static char * G_GNUC_FORMAT (1)
-format_as_comment (const char *format)
+static char * G_GNUC_FORMAT (2)
+format_as_comment (char** freeme, const char *format)
 {
-  return g_strdup_printf ("# %s", format);
+  return *freeme = g_strdup_printf ("# %s", format);
 }
 
 void
@@ -56,10 +56,10 @@ terminal_fprintf (FILE* fp,
         if (verbosity < verbosity_level)
                 return;
 
-        gs_free char *commented_format = format_as_comment (format);
+        gs_free char* freeme;
         va_list args;
         va_start(args, format);
-        g_vfprintf(fp, commented_format, args);
+        g_vfprintf(fp, format_as_comment(&freeme, format), args);
         va_end(args);
 }
 
