summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Escalante Urrelo <descalante@igalia.com>2010-01-13 10:38:33 -0500
committerDiego Escalante Urrelo <diegoe@gnome.org>2010-01-21 09:11:56 -0500
commitb057a59f9aa6f8568b2416172f27034ef4507f22 (patch)
tree6483f948afa79ce6e7fc9c64cd17f471ff3561d2
parentf007602b631fee9ac23c909abb75bd606f501a4f (diff)
downloadepiphany-b057a59f9aa6f8568b2416172f27034ef4507f22.tar.gz
ephy-web-view: plug leaks in ephy_web_view_save
Bug #606876
-rw-r--r--embed/ephy-web-view.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/embed/ephy-web-view.c b/embed/ephy-web-view.c
index 27eddbac0..36d13da0c 100644
--- a/embed/ephy-web-view.c
+++ b/embed/ephy-web-view.c
@@ -3344,21 +3344,23 @@ ephy_web_view_save_sub_resource_start (GList *subresources, char *destination_ur
{
WebKitWebResource *resource;
GFile *file;
- char *resource_uri;
+ const char *resource_uri;
char *resource_name;
+ char *resource_dest_uri;
const GString *data;
resource = WEBKIT_WEB_RESOURCE (subresources->data);
- resource_uri = (char*)webkit_web_resource_get_uri (resource);
+ resource_uri = webkit_web_resource_get_uri (resource);
resource_name = g_path_get_basename (resource_uri);
- resource_uri = g_strdup_printf ("%s/%s",
+ resource_dest_uri = g_strdup_printf ("%s/%s",
destination_uri,
resource_name);
+ g_free (resource_name);
- file = g_file_new_for_uri (resource_uri);
- g_free (resource_uri);
+ file = g_file_new_for_uri (resource_dest_uri);
+ g_free (resource_dest_uri);
g_object_set_data (G_OBJECT (file),
"ephy-web-view-save-dest-uri",
@@ -3402,13 +3404,14 @@ ephy_web_view_save_sub_resources (EphyWebView *view, const char *uri, GList *sub
* when saving html files.
*/
tmp = g_strdup_printf (_("%s Files"), filename);
- destination_uri = g_strdup_printf ("%s/%s", directory_uri, tmp);
- g_free (tmp);
-
g_free (filename);
+
+ destination_uri = g_strdup_printf ("%s/%s", directory_uri, tmp);
g_free (directory_uri);
+ g_free (tmp);
file = g_file_new_for_uri (destination_uri);
+
if (!g_file_make_directory (file, NULL, &error)) {
if (error->code != G_IO_ERROR_EXISTS) {
g_warning ("Could not create directory: %s", error->message);