Coverity fixes
[claws.git] / src / matcher.c
index 1b8e4c9dd0e785264257df079186d905efb168cd..4382c5996aa534ebba0f523f39b38da8edeffc0e 100644 (file)
@@ -313,7 +313,9 @@ MatcherProp *matcherprop_new(gint criteria, const gchar *header,
        prop->expr = expr != NULL ? g_strdup(expr) : NULL;
 
        prop->matchtype = matchtype;
+#ifndef G_OS_WIN32
        prop->preg = NULL;
+#endif
        prop->value = value;
        prop->error = 0;
 
@@ -330,10 +332,12 @@ void matcherprop_free(MatcherProp *prop)
 {
        g_free(prop->expr);
        g_free(prop->header);
+#ifndef G_OS_WIN32
        if (prop->preg != NULL) {
                regfree(prop->preg);
                g_free(prop->preg);
        }
+#endif
        g_free(prop);
 }
 
@@ -353,7 +357,9 @@ MatcherProp *matcherprop_copy(const MatcherProp *src)
        prop->expr = src->expr ? g_strdup(src->expr) : NULL;
        prop->matchtype = src->matchtype;
        
+#ifndef G_OS_WIN32
        prop->preg = NULL; /* will be re-evaluated */
+#endif
        prop->value = src->value;
        prop->error = src->error;       
        return prop;            
@@ -1525,7 +1531,7 @@ static gboolean matcherlist_match_binary_content(MatcherList *matchers, MimeInfo
        gchar buf[BUFFSIZE];
        GSList *l;
 
-       if (partinfo->type == MIMETYPE_TEXT)
+       if (!partinfo || partinfo->type == MIMETYPE_TEXT)
                return FALSE;
        else
                outfp = procmime_get_binary_content(partinfo);
@@ -1545,9 +1551,8 @@ static gboolean matcherlist_match_binary_content(MatcherList *matchers, MimeInfo
                        /* Don't scan non-text parts when looking in body, only
                         * when looking in whole message
                         */
-                       if (partinfo && partinfo->type != MIMETYPE_TEXT &&
-                       (matcher->criteria == MATCHCRITERIA_NOT_BODY_PART ||
-                       matcher->criteria == MATCHCRITERIA_BODY_PART))
+                       if (matcher->criteria == MATCHCRITERIA_NOT_BODY_PART ||
+                           matcher->criteria == MATCHCRITERIA_BODY_PART)
                                continue;
 
                        /* if the criteria is ~body_part or ~message, ZERO lines