summaryrefslogtreecommitdiff
path: root/src/adblock.c
diff options
context:
space:
mode:
authorportix <portix@gmx.net>2011-11-24 01:14:58 +0100
committerportix <portix@gmx.net>2011-11-24 01:14:58 +0100
commitf94c3af193b513709002f88186e3f123c9f2a825 (patch)
tree2a971956332989ba73a836e3bb3aaa0de9f52a33 /src/adblock.c
parent08fa033761bba6527af95e578f0e9af4a898c069 (diff)
downloaddwb-f94c3af193b513709002f88186e3f123c9f2a825.zip
Execute global settings once, fixing double free in adblock.c
--HG-- branch : develop
Diffstat (limited to 'src/adblock.c')
-rw-r--r--src/adblock.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/adblock.c b/src/adblock.c
index 2f98b663..c48d6342 100644
--- a/src/adblock.c
+++ b/src/adblock.c
@@ -199,7 +199,7 @@ adblock_match(GPtrArray *array, const char *uri, const char *host, const char *b
if (rule->options & AO_BEGIN_DOMAIN) {
for (int i=0; suburis[i]; i++) {
if ( (match = adblock_do_match(rule, suburis[i])) )
- goto done;
+ return match;
}
}
else if ((match = adblock_do_match(rule, uri))) {
@@ -207,7 +207,6 @@ adblock_match(GPtrArray *array, const char *uri, const char *host, const char *b
}
}
-done:
return match;
}/*}}}*//*}}}*/
@@ -249,7 +248,7 @@ adblock_content_sniffed_cb(SoupMessage *msg, char *type, GHashTable *table, Soup
else if (!strcmp(type, "text/css")) {
attribute = AA_STYLESHEET;
}
- PRINT_DEBUG("%s %s %d %s\n", host, base_domain, attribute, soup_uri_to_string(uri, false));
+ PRINT_DEBUG("%s %s %d %s\n", host, base_domain, attribute, uri);
if (!adblock_match(_exceptions, uri, host, base_domain, attribute, third_party)) {
if (adblock_match(_rules, uri, host, base_domain, attribute, third_party)) {
soup_session_cancel_message(session, msg, 204);
@@ -367,14 +366,14 @@ adblock_request_started_cb(SoupSession *session, SoupMessage *msg, SoupSocket *s
/* adblock_disconnect(GList *) {{{*/
void
adblock_disconnect(GList *gl) {
- if ((VIEW(gl)->status->signals[SIG_AD_LOAD_STATUS]) > 0) {
- g_signal_handler_disconnect(WEBVIEW(gl), (VIEW(gl)->status->signals[SIG_AD_LOAD_STATUS]));
- VIEW(gl)->status->signals[SIG_AD_LOAD_STATUS] = 0;
- g_signal_handler_disconnect(WEBVIEW(gl), (VIEW(gl)->status->signals[SIG_AD_LOAD_STATUS]));
+ View *v = VIEW(gl);
+ if (v->status->signals[SIG_AD_LOAD_STATUS] > 0) {
+ g_signal_handler_disconnect(WEBVIEW(gl), VIEW(gl)->status->signals[SIG_AD_LOAD_STATUS]);
+ v->status->signals[SIG_AD_LOAD_STATUS] = 0;
}
- if ((VIEW(gl)->status->signals[SIG_AD_RESOURCE_REQUEST]) > 0) {
+ if (v->status->signals[SIG_AD_RESOURCE_REQUEST] > 0) {
g_signal_handler_disconnect(WEBVIEW(gl), (VIEW(gl)->status->signals[SIG_AD_RESOURCE_REQUEST]));
- VIEW(gl)->status->signals[SIG_AD_RESOURCE_REQUEST] = 0;
+ v->status->signals[SIG_AD_RESOURCE_REQUEST] = 0;
}
adblock_set_stylesheet(gl, GET_CHAR("user-stylesheet-uri"));
if (_sig_resource != 0) {