dtmail: Further Coverity fixes

This commit is contained in:
Peter Howkins
2018-04-24 02:38:56 +01:00
parent 9088d6b54e
commit 3cf92f3741
26 changed files with 113 additions and 87 deletions

View File

@@ -267,24 +267,24 @@ MIMEBodyPart::getContentType(DtMailEnv &error, char **mime_type)
{
DtMailValueSeq value;
if (mime_type)
*mime_type = (char *)0;
if (mime_type) {
*mime_type = (char *)0;
if (_body_env)
_body_env->getHeader(error, "Content-Type", DTM_FALSE, value);
if (_body_env) {
_body_env->getHeader(error, "Content-Type", DTM_FALSE, value);
}
if (_body_env && !error.isSet())
{
// Handle "Content-Type: text" problem with /usr/lib/mail.local
if (strcasecmp(*(value[0]), "text")==0)
*mime_type = strdup("text/plain");
else
*mime_type = strdup(*(value[0]));
}
else
{
error.clear();
*mime_type = strdup("text/plain");
if (_body_env && !error.isSet()) {
// Handle "Content-Type: text" problem with /usr/lib/mail.local
if (strcasecmp(*(value[0]), "text")==0) {
*mime_type = strdup("text/plain");
} else {
*mime_type = strdup(*(value[0]));
}
} else {
error.clear();
*mime_type = strdup("text/plain");
}
}
}