diff options
author | Marco Peereboom <marco@conformal.com> | 2011-01-03 22:51:09 +0000 |
---|---|---|
committer | Marco Peereboom <marco@conformal.com> | 2011-01-03 22:51:09 +0000 |
commit | eed1a76c63f884cc7f151be46d27b5ddbf22a36a (patch) | |
tree | e0b40b1860961f3e95ab433c9859c3a2aec47e03 | |
parent | 569bf9a23a7899c8c9006db908e10d64e7a2a623 (diff) | |
download | xombrero-eed1a76c63f884cc7f151be46d27b5ddbf22a36a.tar.gz |
fix a use after free as found by edd and fix a focus issue as found by
stevan
-rw-r--r-- | xxxterm.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/xxxterm.c b/xxxterm.c index 210e8b2..5775d2b 100644 --- a/xxxterm.c +++ b/xxxterm.c @@ -4348,15 +4348,20 @@ cmd_activate_cb(GtkEntry *entry, struct tab *t) if (cmds[i].params) { if (!strncmp(s, cmds[i].cmd, strlen(cmds[i].cmd))) { cmds[i].arg.s = g_strdup(s); - cmds[i].func(t, &cmds[i].arg); + goto execute_command; } } else { if (!strcmp(s, cmds[i].cmd)) - cmds[i].func(t, &cmds[i].arg); + goto execute_command; } done: gtk_widget_hide(t->cmd); + return; + +execute_command: + gtk_widget_hide(t->cmd); + cmds[i].func(t, &cmds[i].arg); } void @@ -4543,7 +4548,7 @@ undo_close_tab_push(const gchar *uri) { struct undo *u1, *u2; - u1 = g_malloc(sizeof(struct undo)); + u1 = g_malloc(sizeof(struct undo)); u1->uri = g_malloc(strlen(uri) * sizeof(gchar)); snprintf(u1->uri, strlen(uri), "%s", uri); @@ -4573,20 +4578,19 @@ delete_tab(struct tab *t) /* Save URI of tab; so we can undo close tab. */ frame = webkit_web_view_get_main_frame(t->wv); - uri = webkit_web_frame_get_uri(frame); - if (uri) + uri = webkit_web_frame_get_uri(frame); + if (uri && strlen(uri)) undo_close_tab_push(uri); TAILQ_REMOVE(&tabs, t, entry); - if (TAILQ_EMPTY(&tabs)) - create_new_tab(NULL, 1); + recalc_tabs(); gtk_widget_destroy(t->vbox); - g_free(t->user_agent); g_free(t); - recalc_tabs(); + if (TAILQ_EMPTY(&tabs)) + create_new_tab(NULL, 1); } void |