1
0
Fork 0

various memory leak fixes

This commit is contained in:
bagyenda 2008-04-18 13:54:08 +00:00
parent cf2f4e7d8e
commit 232351d5ce
1 changed files with 15 additions and 16 deletions

View File

@ -654,7 +654,6 @@ static void replace_body(MIMEEntity *msg, Octstr *newbody, List *params_h,
List *h = mime_entity_headers(msg);
mime_entity_set_body(msg, newbody); /* Replace the body. */
octstr_destroy(newbody);
if ((part_name = http_header_value(params_h, octstr_imm("name"))) != NULL) {
Octstr *tmp = mknewname(part_name, file_ext);
@ -675,7 +674,7 @@ static void replace_body(MIMEEntity *msg, Octstr *newbody, List *params_h,
}
mime_replace_headers(msg,h);
http_destroy_headers(h);
if (new_partname) octstr_destroy(new_partname);
octstr_destroy(new_partname);
}
/* Modify the message based on the user agent profile data. Return 1 if was supported, 0
@ -755,7 +754,7 @@ static int modify_msg(MIMEEntity *msg, MmsUaProfile *prof)
replace_ctype(h, "multipart/mixed", params_h);
}
if (startp) octstr_destroy(startp);
octstr_destroy(startp);
supported = 1;
goto done;
@ -779,7 +778,7 @@ static int modify_msg(MIMEEntity *msg, MmsUaProfile *prof)
if (charset == NULL ||
octstr_str_compare(charset, "unknown") == 0) {
if (charset) octstr_destroy(charset);
octstr_destroy(charset);
charset = octstr_imm(DEFAULT_CHARSET);
}
@ -812,8 +811,9 @@ static int modify_msg(MIMEEntity *msg, MmsUaProfile *prof)
octstr_destroy(ct);
mime_entity_set_body(msg,s); /* replace with new body. */
octstr_destroy(s);
break; /* We succeeded in converting it so we shd go away. */
} else
} else
octstr_destroy(s);
}
@ -965,6 +965,7 @@ static int modify_msg(MIMEEntity *msg, MmsUaProfile *prof)
replace_body(msg, s, params_h,
cformats[oindex].content_type,
cformats[oindex].file_ext,0);
octstr_destroy(s);
supported = 1;
goto done2; /* we are done, don't even change headers. */
} else /* failed to convert, hence unsupported. */
@ -978,12 +979,10 @@ static int modify_msg(MIMEEntity *msg, MmsUaProfile *prof)
remove_object(msg, content_type);
if (h)
http_destroy_headers(h);
if (content_type)
octstr_destroy(content_type);
if (params)
octstr_destroy(params);
http_destroy_headers(h);
octstr_destroy(content_type);
octstr_destroy(params);
if (params_h)
http_destroy_headers(params_h);
if (tmpf[0])
@ -991,9 +990,8 @@ static int modify_msg(MIMEEntity *msg, MmsUaProfile *prof)
if (tmpf2[0])
unlink(tmpf2);
if (cmd)
octstr_destroy(cmd);
octstr_destroy(cmd);
return supported;
}
@ -1305,11 +1303,12 @@ static int format_special(MIMEEntity *m,
if (n < 0 || o != 0)
goto done; /* Error -- finish up. */
if ((s = octstr_read_file(tmpf)) != NULL)
if ((s = octstr_read_file(tmpf)) != NULL) {
replace_body(m, s, params_h,
cformats[ipref].content_type,
cformats[ipref].file_ext,1);
else
octstr_destroy(s);
} else
goto done;
} else if (type == TTEXT) {/* change to default charset. */