From a75b186bfabe99a2782cda903fd35b9eae6cd665 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 10 Feb 2016 22:59:45 +0000 Subject: Fix issues found by coverity --- src/libmime/mime_expressions.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/libmime/mime_expressions.c b/src/libmime/mime_expressions.c index 6a422e82e..ba2045ee4 100644 --- a/src/libmime/mime_expressions.c +++ b/src/libmime/mime_expressions.c @@ -678,10 +678,8 @@ set: return a; err: - if (mime_atom != NULL) { - g_free (mime_atom->str); - g_slice_free1 (sizeof (*mime_atom), mime_atom); - } + g_free (mime_atom->str); + g_slice_free1 (sizeof (*mime_atom), mime_atom); return NULL; } @@ -1348,12 +1346,16 @@ rspamd_has_html_tag (struct rspamd_task * task, GArray * args, void *unused) return FALSE; } - for (i = 0; i < task->text_parts->len && res; i ++) { + for (i = 0; i < task->text_parts->len; i ++) { p = g_ptr_array_index (task->text_parts, i); if (!IS_PART_EMPTY (p) && IS_PART_HTML (p) && p->html) { res = rspamd_html_tag_seen (p->html, arg->data); } + + if (res) { + break; + } } return res; @@ -1849,6 +1851,8 @@ common_has_content_part (struct rspamd_task * task, if (r && param_subtype) { r = compare_len (part, min_len, max_len) && compare_subtype (task, ct, param_subtype); + + return r; } } else { -- cgit v1.2.3