Fix memory leaks

This commit is contained in:
Daniel Winzen 2015-04-28 08:44:13 +02:00
parent 1df576c72e
commit ba753120df
2 changed files with 4 additions and 0 deletions

View File

@ -703,6 +703,7 @@ static int upnpc_build_soap_request(upnpc_t * p, const char * url,
body = malloc(body_len + 1);
if(body == NULL) {
p->state = EError;
free(args_xml);
return -1;
}
if(snprintf(body, body_len + 1, fmt_soap, action, service, args_xml?args_xml:"", action) != body_len) {
@ -712,6 +713,7 @@ static int upnpc_build_soap_request(upnpc_t * p, const char * url,
args_xml = NULL;
if(!parseURL(url, hostname, &port, &path, &scope_id)) {
p->state = EError;
free(body);
return -1;
}
if(port != 80)

View File

@ -614,6 +614,7 @@ static int upnpc_send_soap_request(upnpc_device_t * p, const char * url,
body_len = snprintf(NULL, 0, fmt_soap, method, service, args_xml?args_xml:"", method);
body = malloc(body_len + 1);
if(body == NULL) {
free(args_xml);
return -1;
}
if(snprintf(body, body_len + 1, fmt_soap, method, service, args_xml?args_xml:"", method) != body_len) {
@ -622,6 +623,7 @@ static int upnpc_send_soap_request(upnpc_device_t * p, const char * url,
free(args_xml);
args_xml = NULL;
if(!parseURL(url, hostname, &port, &path, &scope_id)) {
free(body);
return -1;
}
if(port != 80)