mem leak fix
This commit is contained in:
parent
1eb8f06cb6
commit
58ebfcc0fd
|
@ -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>
|
2011-10-03 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||||
* Fixed: compilation issue
|
* Fixed: compilation issue
|
||||||
2011-09-23 P. A. Bagyenda <bagyenda@dsmagic.com>
|
2011-09-23 P. A. Bagyenda <bagyenda@dsmagic.com>
|
||||||
|
|
|
@ -250,7 +250,7 @@ MmsUaProfile *mms_make_ua_profile(List *req_headers)
|
||||||
octstr_get_cstr(ua));
|
octstr_get_cstr(ua));
|
||||||
|
|
||||||
/* Done. Dump it while debugging. */
|
/* Done. Dump it while debugging. */
|
||||||
done:
|
done:
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
dump_profile(prof, ua ? ua : octstr_imm("<from http headers>"));
|
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! */
|
xmlStrcasecmp(xname, (const xmlChar *)"MmsCcppAccept-CharSet") == 0) {/* Cranky old ones! */
|
||||||
int i, n;
|
int i, n;
|
||||||
prof->ccppaccept.charset = l;
|
prof->ccppaccept.charset = l;
|
||||||
|
l = NULL; /* Avoid deletion below */
|
||||||
prof->ccppaccept._chash = gwlist_create();
|
prof->ccppaccept._chash = gwlist_create();
|
||||||
for (i = 0, n = gwlist_len(l); i<n; i++)
|
for (i = 0, n = gwlist_len(l); i<n; i++)
|
||||||
gwlist_append(prof->ccppaccept._chash, (void *)hash_key(gwlist_get(l, 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;
|
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;
|
prof->ccppaccept.enc = l;
|
||||||
else if (xmlStrcasecmp(xname, (const xmlChar *)"MmsVersion") == 0) {
|
l = NULL; /* Avoid deletion below */
|
||||||
if (!l && childtext) { /* SonyEriccson uses old format! */
|
} else if (xmlStrcasecmp(xname, (const xmlChar *)"MmsVersion") == 0) {
|
||||||
|
if (l == NULL && childtext) { /* SonyEriccson uses old format! */
|
||||||
l = gwlist_create();
|
l = gwlist_create();
|
||||||
gwlist_append(l, octstr_create((char *)childtext));
|
gwlist_append(l, octstr_create((char *)childtext));
|
||||||
}
|
}
|
||||||
prof->versions = l;
|
prof->versions = l;
|
||||||
|
l = NULL; /* Avoid deletion below */
|
||||||
} else if (xmlStrcasecmp(xname, (const xmlChar *)"MmsCcppAccept") == 0) {
|
} else if (xmlStrcasecmp(xname, (const xmlChar *)"MmsCcppAccept") == 0) {
|
||||||
int i, n;
|
int i, n;
|
||||||
prof->ccppaccept.content = l;
|
prof->ccppaccept.content = l;
|
||||||
|
@ -342,11 +346,13 @@ static MmsUaProfile *parse_uaprofile(Octstr *xml)
|
||||||
|
|
||||||
gwlist_append(prof->ccppaccept._hash, (void *)hash_key(x));
|
gwlist_append(prof->ccppaccept._hash, (void *)hash_key(x));
|
||||||
}
|
}
|
||||||
|
l = NULL; /* Avoid deletion below */
|
||||||
}
|
}
|
||||||
if (childtext) xmlFree(childtext);
|
if (childtext) xmlFree(childtext);
|
||||||
|
gwlist_destroy(l, (void *)octstr_destroy);
|
||||||
}
|
}
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (doc) xmlFreeDoc(doc);
|
if (doc) xmlFreeDoc(doc);
|
||||||
return prof;
|
return prof;
|
||||||
}
|
}
|
||||||
|
@ -977,10 +983,10 @@ static int modify_msg(MIMEEntity *msg, MmsUaProfile *prof)
|
||||||
} else /* failed to convert, hence unsupported. */
|
} else /* failed to convert, hence unsupported. */
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
done:
|
done:
|
||||||
if (h)
|
if (h)
|
||||||
mime_replace_headers(msg,h);
|
mime_replace_headers(msg,h);
|
||||||
done2:
|
done2:
|
||||||
if (!supported)
|
if (!supported)
|
||||||
remove_object(msg, content_type);
|
remove_object(msg, content_type);
|
||||||
|
|
||||||
|
@ -1346,7 +1352,7 @@ static int format_special(MIMEEntity *m,
|
||||||
octstr_destroy(s);
|
octstr_destroy(s);
|
||||||
} /* Else do nothing. */
|
} /* Else do nothing. */
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
|
||||||
if (headers) {
|
if (headers) {
|
||||||
mime_replace_headers(m, headers);
|
mime_replace_headers(m, headers);
|
||||||
|
|
|
@ -2907,12 +2907,13 @@ void get_content_from_sendmms_request(Octstr *body, List *headers, List *cgivars
|
||||||
{
|
{
|
||||||
Octstr *s;
|
Octstr *s;
|
||||||
/* Now get the data. */
|
/* 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");
|
Octstr *charset = http_cgi_variable(cgivars, "charset");
|
||||||
|
|
||||||
*ctype = octstr_format("text/plain");
|
*ctype = octstr_format("text/plain");
|
||||||
if (charset)
|
if (charset)
|
||||||
octstr_format_append(*ctype, "; charset=%S", charset);
|
octstr_format_append(*ctype, "; charset=%S", charset);
|
||||||
|
*data = octstr_duplicate(s);
|
||||||
} else if ((s = http_cgi_variable(cgivars, "smil")) != NULL) { /* smil. */
|
} else if ((s = http_cgi_variable(cgivars, "smil")) != NULL) { /* smil. */
|
||||||
*ctype = octstr_create("application/smil");
|
*ctype = octstr_create("application/smil");
|
||||||
*data = octstr_duplicate(s);
|
*data = octstr_duplicate(s);
|
||||||
|
|
Loading…
Reference in New Issue