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

@ -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,8 +346,10 @@ 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:

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);