Fix several minor bugs in soap_device.c

1) remove redundant free
2) avoid user-provided ErrStr being overwritten by the default one
3) eliminated memory leak possiblity in handle_query_variable

Signed-off-by: Marcelo Roberto Jimenez <mroberto@users.sourceforge.net>
This commit is contained in:
Peng 2013-11-08 22:47:20 +08:00 committed by Marcelo Roberto Jimenez
parent 908785fba7
commit bf60dc06e0
2 changed files with 10 additions and 2 deletions

View File

@ -2,6 +2,14 @@
Version 1.6.19
*******************************************************************************
2013-11-08 Peng <howtofly(at)gmail.com>
Fix several minor bugs in soap_device.c
1) remove redundant free
2) avoid user-provided ErrStr being overwritten by the default one
3) eliminated memory leak possiblity in handle_query_variable
2013-11-08 Peng <howtofly(at)gmail.com>
Fix return value check of parse_uri.

View File

@ -415,7 +415,6 @@ static int check_soap_action_header(
temp_header_value = malloc(soap_action_header->value.length + 1);
if (!temp_header_value) {
ret_code = UPNP_E_OUTOF_MEMORY;
free(temp_header_value);
return ret_code;
}
strncpy(temp_header_value, soap_action_header->value.buf,
@ -728,7 +727,7 @@ static UPNP_INLINE void handle_query_variable(
return;
}
if (variable.ErrCode != UPNP_E_SUCCESS) {
if (strlen(variable.ErrStr) > 0) {
if (strlen(variable.ErrStr) == 0) {
err_code = SOAP_INVALID_VAR;
err_str = Soap_Invalid_Var;
} else {
@ -736,6 +735,7 @@ static UPNP_INLINE void handle_query_variable(
err_str = variable.ErrStr;
}
send_error_response(info, err_code, err_str, request);
ixmlFreeDOMString(variable.CurrentVal);
return;
}
/* send response */