aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-09-16 16:39:11 -0700
committerDavid Robillard <d@drobilla.net>2016-09-16 16:39:11 -0700
commit25cdc0a3a8a7a947b66ea95e56afb306f5d0bbe6 (patch)
treecb12894f78100fba329c0a62fff563656f325c73 /src
parent701f67947d415feb416cfab83938380b063d6624 (diff)
downloadjalv-25cdc0a3a8a7a947b66ea95e56afb306f5d0bbe6.tar.gz
jalv-25cdc0a3a8a7a947b66ea95e56afb306f5d0bbe6.tar.bz2
jalv-25cdc0a3a8a7a947b66ea95e56afb306f5d0bbe6.zip
Fix memory error on preset save
Diffstat (limited to 'src')
-rw-r--r--src/jalv_gtk.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/jalv_gtk.c b/src/jalv_gtk.c
index 82df8b4..3d7e2ab 100644
--- a/src/jalv_gtk.c
+++ b/src/jalv_gtk.c
@@ -400,15 +400,14 @@ on_save_preset_activate(GtkWidget* widget, void* ptr)
gtk_entry_set_activates_default(GTK_ENTRY(uri_entry), TRUE);
gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT);
if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_ACCEPT) {
- const char* path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
- const char* uri = gtk_entry_get_text(GTK_ENTRY(uri_entry));
- const char* prefix = "";
- const char* sep = "";
+ LilvNode* plug_name = lilv_plugin_get_name(jalv->plugin);
+ const char* path = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog));
+ const char* uri = gtk_entry_get_text(GTK_ENTRY(uri_entry));
+ const char* prefix = "";
+ const char* sep = "";
if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(add_prefix))) {
- LilvNode* plug_name = lilv_plugin_get_name(jalv->plugin);
prefix = lilv_node_as_string(plug_name);
sep = "_";
- lilv_node_free(plug_name);
}
char* dirname = g_path_get_dirname(path);
@@ -434,9 +433,11 @@ on_save_preset_activate(GtkWidget* widget, void* ptr)
g_free(dir);
g_free(file);
g_free(bundle);
+ free(sprefix);
free(sym);
g_free(basename);
g_free(dirname);
+ lilv_node_free(plug_name);
}
gtk_widget_destroy(GTK_WIDGET(dialog));