From: Andrew Lewis Date: Wed, 21 Dec 2016 13:49:57 +0000 (+0200) Subject: [Fix] Avoid reusing g_error (Fixes #1262) X-Git-Tag: 1.5.0~515^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F1276%2Fhead;p=thirdparty%2Frspamd.git [Fix] Avoid reusing g_error (Fixes #1262) Reported by: @jhejl --- diff --git a/src/libserver/dkim.c b/src/libserver/dkim.c index 873d59d22b..00b633b181 100644 --- a/src/libserver/dkim.c +++ b/src/libserver/dkim.c @@ -1130,6 +1130,11 @@ rspamd_dkim_dns_cb (struct rdns_reply *reply, gpointer arg) LL_FOREACH (reply->entries, elt) { if (elt->type == RDNS_REQUEST_TXT) { + if (err != NULL) { + /* Free error as it is insignificant */ + g_error_free (err); + err = NULL; + } key = rspamd_dkim_parse_key (cbdata->ctx, elt->content.txt.data, &keylen, &err); @@ -1139,11 +1144,6 @@ rspamd_dkim_dns_cb (struct rdns_reply *reply, gpointer arg) } } } - if (key != NULL && err != NULL) { - /* Free error as it is insignificant */ - g_error_free (err); - err = NULL; - } cbdata->handler (key, keylen, cbdata->ctx, cbdata->ud, err); } }