1
0
Fork 0

mem leak fix

This commit is contained in:
bagyenda 2011-10-12 05:13:29 +00:00
parent 1eb8f06cb6
commit 58ebfcc0fd
3 changed files with 52 additions and 43 deletions

View File

@ -1,3 +1,5 @@
2011-10-11 P. A. Bagyenda <bagyenda@dsmagic.com>
* Fixed mem leaks in mmsc uaprof module
2011-10-03 P. A. Bagyenda <bagyenda@dsmagic.com>
* Fixed: compilation issue
2011-09-23 P. A. Bagyenda <bagyenda@dsmagic.com>

View File

@ -250,7 +250,7 @@ MmsUaProfile *mms_make_ua_profile(List *req_headers)
octstr_get_cstr(ua));
/* Done. Dump it while debugging. */
done:
done:
#if 1
dump_profile(prof, ua ? ua : octstr_imm("<from http headers>"));
@ -315,19 +315,23 @@ static MmsUaProfile *parse_uaprofile(Octstr *xml)
xmlStrcasecmp(xname, (const xmlChar *)"MmsCcppAccept-CharSet") == 0) {/* Cranky old ones! */
int i, n;
prof->ccppaccept.charset = l;
l = NULL; /* Avoid deletion below */
prof->ccppaccept._chash = gwlist_create();
for (i = 0, n = gwlist_len(l); i<n; i++)
gwlist_append(prof->ccppaccept._chash, (void *)hash_key(gwlist_get(l, i)));
} else if (xmlStrcasecmp(xname, (const xmlChar *)"MmsCcppAcceptLanguage") == 0)
} else if (xmlStrcasecmp(xname, (const xmlChar *)"MmsCcppAcceptLanguage") == 0) {
prof->ccppaccept.lang = l;
else if (xmlStrcasecmp(xname, (const xmlChar *)"MmsCcppAcceptEncoding") == 0)
l = NULL; /* Avoid deletion below */
} else if (xmlStrcasecmp(xname, (const xmlChar *)"MmsCcppAcceptEncoding") == 0) {
prof->ccppaccept.enc = l;
else if (xmlStrcasecmp(xname, (const xmlChar *)"MmsVersion") == 0) {
if (!l && childtext) { /* SonyEriccson uses old format! */
l = NULL; /* Avoid deletion below */
} else if (xmlStrcasecmp(xname, (const xmlChar *)"MmsVersion") == 0) {
if (l == NULL && childtext) { /* SonyEriccson uses old format! */
l = gwlist_create();
gwlist_append(l, octstr_create((char *)childtext));
}
prof->versions = l;
l = NULL; /* Avoid deletion below */
} else if (xmlStrcasecmp(xname, (const xmlChar *)"MmsCcppAccept") == 0) {
int i, n;
prof->ccppaccept.content = l;
@ -342,11 +346,13 @@ static MmsUaProfile *parse_uaprofile(Octstr *xml)
gwlist_append(prof->ccppaccept._hash, (void *)hash_key(x));
}
l = NULL; /* Avoid deletion below */
}
if (childtext) xmlFree(childtext);
gwlist_destroy(l, (void *)octstr_destroy);
}
done:
done:
if (doc) xmlFreeDoc(doc);
return prof;
}
@ -977,10 +983,10 @@ static int modify_msg(MIMEEntity *msg, MmsUaProfile *prof)
} else /* failed to convert, hence unsupported. */
goto done;
done:
done:
if (h)
mime_replace_headers(msg,h);
done2:
done2:
if (!supported)
remove_object(msg, content_type);
@ -1346,7 +1352,7 @@ static int format_special(MIMEEntity *m,
octstr_destroy(s);
} /* Else do nothing. */
done:
done:
if (headers) {
mime_replace_headers(m, headers);

View File

@ -2907,12 +2907,13 @@ void get_content_from_sendmms_request(Octstr *body, List *headers, List *cgivars
{
Octstr *s;
/* Now get the data. */
if ((*data = http_cgi_variable(cgivars, "text")) != NULL) { /* text. */
if ((s = http_cgi_variable(cgivars, "text")) != NULL) { /* text. */
Octstr *charset = http_cgi_variable(cgivars, "charset");
*ctype = octstr_format("text/plain");
if (charset)
octstr_format_append(*ctype, "; charset=%S", charset);
*data = octstr_duplicate(s);
} else if ((s = http_cgi_variable(cgivars, "smil")) != NULL) { /* smil. */
*ctype = octstr_create("application/smil");
*data = octstr_duplicate(s);