From: erg Date: Tue, 23 Jun 2009 22:16:05 +0000 (+0000) Subject: Fix logic for empty input; X-Git-Tag: LAST_LIBGRAPH~32^2~1886 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=62bccf571b4a92f8f26fa9046c511422a99e6ab0;p=graphviz Fix logic for empty input; free gtk buffer with g_free --- diff --git a/cmd/smyrna/gui/menucallbacks.c b/cmd/smyrna/gui/menucallbacks.c index d8568dc7c..5f9b903c1 100755 --- a/cmd/smyrna/gui/menucallbacks.c +++ b/cmd/smyrna/gui/menucallbacks.c @@ -510,7 +510,7 @@ void mTestgvpr(GtkWidget * widget, gpointer user_data) gtk_text_buffer_get_end_iter (gtkbuf,&endit); bf2 = gtk_text_buffer_get_text(gtkbuf,&startit,&endit,0); - if ((*args == '\0') && (*bf2 != '\0')) + if ((*args == '\0') && (*bf2 == '\0')) return; inargv = splitArgs (args, &inargc); @@ -531,14 +531,16 @@ void mTestgvpr(GtkWidget * widget, gpointer user_data) for (i = 0; i < inargc; i++) argv[j++] = inargv[i]; free (inargv); - if (*bf2 != '\0') - argv[j++] = bf2; + if (*bf2 != '\0') { + argv[j++] = strdup(bf2); + g_free (bf2); + } assert (j == argc); run_gvpr (view->g[view->activeGraph], argc, argv); -/* for (i = 1; i < argc; i++) + for (i = 1; i < argc; i++) free (argv[i]); - free (argv);*/ + free (argv); }