From 9faaf34665ebd4bd948812eda5e7334e2d89c4aa Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sat, 5 Jan 2013 00:09:06 -0500 Subject: [PATCH] free the directory argument --- termite.cc | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/termite.cc b/termite.cc index 041a11d..da4b92a 100644 --- a/termite.cc +++ b/termite.cc @@ -1163,7 +1163,7 @@ static void exit_with_status(VteTerminal *vte) { int main(int argc, char **argv) { GError *error = NULL; const char *const term = "xterm-termite"; - const char *directory = nullptr; + char *directory = nullptr; gboolean version = FALSE, hold = FALSE; GOptionContext *context = g_option_context_new(NULL); @@ -1190,9 +1190,12 @@ int main(int argc, char **argv) { return EXIT_SUCCESS; } - if (directory && chdir(directory) == -1) { - perror("chdir"); - return EXIT_FAILURE; + if (directory) { + if (chdir(directory) == -1) { + perror("chdir"); + return EXIT_FAILURE; + } + g_free(directory); } GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);