Squash some memory leaks.

svn path=/trunk/netsurf/; revision=6290
This commit is contained in:
Sean Fox 2009-01-29 08:13:28 +00:00
parent 619e5b9631
commit ab3da70659
2 changed files with 13 additions and 6 deletions

View File

@ -66,9 +66,10 @@ void nsgtk_about_dialog_init(GtkWindow *parent, struct browser_window *bw,
const char *version)
{
gchar *licence_text;
gchar *licence_location = g_strconcat(res_dir_location, "licence", NULL);
g_file_get_contents(g_strconcat(res_dir_location, "licence", NULL),
&licence_text, NULL, NULL);
g_file_get_contents(licence_location, &licence_text, NULL, NULL);
free(licence_location);
gtk_about_dialog_set_url_hook (launch_url, (gpointer) bw, NULL);
gtk_show_about_dialog(parent, "artists", artists, "authors", authors,

View File

@ -215,7 +215,7 @@ struct gui_download_window *gui_download_window_create(const char *url,
strcpy(domain, messages_get("gtkUnknownHost"));
destination = nsgtk_download_dialog_show(filename, domain, size);
if (destination == NULL)
if (destination == NULL)
return NULL;
/* Add the new row and store the reference to it (which keeps track of
@ -236,12 +236,15 @@ struct gui_download_window *gui_download_window_create(const char *url,
download->time_remaining = -1;
download->status = NSGTK_DOWNLOAD_NONE;
download->filename = destination;
download->progress = 0;
download->progress = 0;
download->error = NULL;
download->write = g_io_channel_new_file(destination, "w",
download->write = g_io_channel_new_file(destination, "w",
&download->error);
if (nsgtk_download_handle_error(download->error)) {
free(download);
g_string_free(download->name, TRUE);
g_string_free(download->time_left, TRUE);
g_free(download->filename);
free(download);
return NULL;
}
g_io_channel_set_encoding(download->write, NULL,
@ -527,6 +530,9 @@ void nsgtk_download_store_clear_item (struct gui_download_window *dl)
gtk_tree_row_reference_get_path(dl->row));
gtk_list_store_remove(nsgtk_download_store,
&nsgtk_download_iter);
g_string_free(dl->name, TRUE);
g_string_free(dl->time_left, TRUE);
g_free(dl->filename);
g_free(dl);
nsgtk_download_sensitivity_evaluate(nsgtk_download_selection);