diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2003-12-06 21:57:16 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2003-12-06 21:57:16 +0800 |
commit | b42fc17aa426df8a17f73db102c440199709d578 (patch) | |
tree | e527d9be0f688d946666a1d777d23ea305d8ef71 /embed/mozilla/mozilla-embed.cpp | |
parent | 03d9a4160c0a00986d894ac7241f57509a6d80a6 (diff) | |
download | gsoc2013-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>.
Diffstat (limited to 'embed/mozilla/mozilla-embed.cpp')
-rw-r--r-- | embed/mozilla/mozilla-embed.cpp | 45 |
1 files changed, 32 insertions, 13 deletions
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); |