aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2003-12-06 21:57:16 +0800
committerChristian Persch <chpe@src.gnome.org>2003-12-06 21:57:16 +0800
commitb42fc17aa426df8a17f73db102c440199709d578 (patch)
treee527d9be0f688d946666a1d777d23ea305d8ef71
parent03d9a4160c0a00986d894ac7241f57509a6d80a6 (diff)
downloadgsoc2013-epiphany-b42fc17aa426df8a17f73db102c440199709d578.tar
gsoc2013-epiphany-b42fc17aa426df8a17f73db102c440199709d578.tar.gz
gsoc2013-epiphany-b42fc17aa426df8a17f73db102c440199709d578.tar.bz2
gsoc2013-epiphany-b42fc17aa426df8a17f73db102c440199709d578.tar.lz
gsoc2013-epiphany-b42fc17aa426df8a17f73db102c440199709d578.tar.xz
gsoc2013-epiphany-b42fc17aa426df8a17f73db102c440199709d578.tar.zst
gsoc2013-epiphany-b42fc17aa426df8a17f73db102c440199709d578.zip
Fix some mem leaks. Bug report and patch by JF Rameau
2003-12-06 Christian Persch <chpe@cvs.gnome.org> * embed/downloader-view.c: (open_selection_foreach): * embed/mozilla/mozilla-embed.cpp: Fix some mem leaks. Bug report and patch by JF Rameau <jframeau@cyberdeck.com>.
-rw-r--r--ChangeLog8
-rw-r--r--embed/downloader-view.c4
-rw-r--r--embed/mozilla/mozilla-embed.cpp45
3 files changed, 43 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index fb9c82a4d..c79fbd376 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2003-12-06 Christian Persch <chpe@cvs.gnome.org>
+
+ * embed/downloader-view.c: (open_selection_foreach):
+ * embed/mozilla/mozilla-embed.cpp:
+
+ Fix some mem leaks. Bug report and patch by
+ JF Rameau <jframeau@cyberdeck.com>.
+
2003-12-05 Christian Persch <chpe@cvs.gnome.org>
* embed/mozilla/EphyWrapper.cpp:
diff --git a/embed/downloader-view.c b/embed/downloader-view.c
index 70a930fd9..2e0679e49 100644
--- a/embed/downloader-view.c
+++ b/embed/downloader-view.c
@@ -1076,7 +1076,7 @@ open_selection_foreach (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *ite
if (details->status != DOWNLOAD_STATUS_COMPLETED) return;
mime = gnome_vfs_get_mime_type (details->dest);
- g_return_if_fail (mime != NULL);
+ if (mime == NULL) return;
app = gnome_vfs_mime_get_default_application (mime);
if (app)
@@ -1084,6 +1084,8 @@ open_selection_foreach (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *ite
ephy_file_launch_application (app->command,
details->dest,
app->requires_terminal);
+
+ gnome_vfs_mime_application_free(app);
}
else
{
diff --git a/embed/mozilla/mozilla-embed.cpp b/embed/mozilla/mozilla-embed.cpp
index e2eeeb6b8..b66429a0a 100644
--- a/embed/mozilla/mozilla-embed.cpp
+++ b/embed/mozilla/mozilla-embed.cpp
@@ -540,22 +540,24 @@ impl_can_go_forward (EphyEmbed *embed)
static gresult
impl_can_go_up (EphyEmbed *embed)
{
- char *location;
+ char *location = NULL;
char *s;
- gresult result;
+ gresult result = G_FAILED;
if (ephy_embed_get_location (embed, TRUE, &location) != G_OK)
- return G_FAILED;
+ {
+ g_free (location);
+
+ return G_FAILED;
+ }
+
g_return_val_if_fail (location != NULL, G_FAILED);
+
if ((s = mozilla_embed_get_uri_parent (location)) != NULL)
{
g_free (s);
result = G_OK;
}
- else
- {
- result = G_FAILED;
- }
g_free (location);
@@ -565,14 +567,20 @@ impl_can_go_up (EphyEmbed *embed)
static gresult
impl_get_go_up_list (EphyEmbed *embed, GSList **l)
{
- char *location;
+ char *location = NULL;
char *s;
+ *l = NULL;
+
if (ephy_embed_get_location (embed, TRUE, &location) != G_OK)
+ {
+ g_free (location);
+
return G_FAILED;
+ }
+
g_return_val_if_fail (location != NULL, G_FAILED);
- *l = NULL;
s = location;
while ((s = mozilla_embed_get_uri_parent (s)) != NULL)
{
@@ -580,6 +588,7 @@ impl_get_go_up_list (EphyEmbed *embed, GSList **l)
}
g_free (location);
+
*l = g_slist_reverse (*l);
return G_OK;
@@ -604,15 +613,25 @@ impl_go_forward (EphyEmbed *embed)
static gresult
impl_go_up (EphyEmbed *embed)
{
- char *uri;
+ char *uri = NULL;
char *parent_uri;
-
- ephy_embed_get_location (embed, TRUE, &uri);
+
+ if (ephy_embed_get_location (embed, TRUE, &uri) != G_OK)
+ {
+ g_free (uri);
+
+ return G_FAILED;
+ }
+
g_return_val_if_fail (uri != NULL, G_FAILED);
parent_uri = mozilla_embed_get_uri_parent (uri);
g_free (uri);
- g_return_val_if_fail (parent_uri != NULL, G_FAILED);
+
+ if (parent_uri == NULL)
+ {
+ return G_FAILED;
+ }
ephy_embed_load_url (embed, parent_uri);