Memory leak fix in handle_query_variable
variable was never freed.
This commit is contained in:
parent
d02c01fa6e
commit
eb16f52b1a
@ -2,6 +2,12 @@
|
|||||||
Version 1.8.0
|
Version 1.8.0
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
|
||||||
|
2012-03-08 Fabrice Fontaine <fabrice.fontaine(at)orange-ftgroup.com>
|
||||||
|
|
||||||
|
Memory leak fix in handle_query_variable
|
||||||
|
|
||||||
|
variable was never freed.
|
||||||
|
|
||||||
2011-02-07 Chandra Penke <chandrapenke(at)mcntech.com>
|
2011-02-07 Chandra Penke <chandrapenke(at)mcntech.com>
|
||||||
|
|
||||||
Add HTTPS support using OpenSSL. HTTPS support is optional and can
|
Add HTTPS support using OpenSSL. HTTPS support is optional and can
|
||||||
|
@ -693,24 +693,21 @@ static UPNP_INLINE void handle_query_variable(
|
|||||||
void *cookie;
|
void *cookie;
|
||||||
char var_name[LINE_SIZE];
|
char var_name[LINE_SIZE];
|
||||||
const char *err_str;
|
const char *err_str;
|
||||||
int err_code;
|
int err_code = 0;
|
||||||
|
|
||||||
if (get_var_name(xml_doc, var_name) != 0) {
|
/* set default error */
|
||||||
send_error_response(info, SOAP_INVALID_VAR,
|
err_code = SOAP_INVALID_VAR;
|
||||||
Soap_Invalid_Var, request);
|
err_str = Soap_Invalid_Var;
|
||||||
return;
|
|
||||||
}
|
if (get_var_name(xml_doc, var_name) != 0)
|
||||||
|
goto error_handler;
|
||||||
/* get info for event */
|
/* get info for event */
|
||||||
err_code = get_device_info(request, 1, xml_doc,
|
if (get_device_info(request, 1, xml_doc,
|
||||||
info->foreign_sockaddr.ss_family,
|
info->foreign_sockaddr.ss_family,
|
||||||
(UpnpString *)UpnpStateVarRequest_get_DevUDN(variable),
|
(UpnpString *)UpnpStateVarRequest_get_DevUDN(variable),
|
||||||
(UpnpString *)UpnpStateVarRequest_get_ServiceID(variable),
|
(UpnpString *)UpnpStateVarRequest_get_ServiceID(variable),
|
||||||
&soap_event_callback, &cookie);
|
&soap_event_callback, &cookie) != 0)
|
||||||
if (err_code != 0) {
|
goto error_handler;
|
||||||
send_error_response(info, SOAP_INVALID_VAR,
|
|
||||||
Soap_Invalid_Var, request);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
UpnpStateVarRequest_set_ErrCode(variable, UPNP_E_SUCCESS);
|
UpnpStateVarRequest_set_ErrCode(variable, UPNP_E_SUCCESS);
|
||||||
UpnpStateVarRequest_strcpy_StateVarName(variable, var_name);
|
UpnpStateVarRequest_strcpy_StateVarName(variable, var_name);
|
||||||
UpnpStateVarRequest_set_CtrlPtIPAddr(variable, &info->foreign_sockaddr);
|
UpnpStateVarRequest_set_CtrlPtIPAddr(variable, &info->foreign_sockaddr);
|
||||||
@ -719,28 +716,23 @@ static UPNP_INLINE void handle_query_variable(
|
|||||||
UpnpPrintf(UPNP_INFO, SOAP, __FILE__, __LINE__,
|
UpnpPrintf(UPNP_INFO, SOAP, __FILE__, __LINE__,
|
||||||
"Return from callback for var request\n");
|
"Return from callback for var request\n");
|
||||||
/* validate, and handle result */
|
/* validate, and handle result */
|
||||||
if (UpnpStateVarRequest_get_CurrentVal(variable) == NULL) {
|
if (UpnpStateVarRequest_get_CurrentVal(variable) == NULL)
|
||||||
err_code = SOAP_ACTION_FAILED;
|
goto error_handler;
|
||||||
err_str = Soap_Action_Failed;
|
|
||||||
send_error_response(info, SOAP_INVALID_VAR, Soap_Invalid_Var,
|
|
||||||
request);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (UpnpStateVarRequest_get_ErrCode(variable) != UPNP_E_SUCCESS) {
|
if (UpnpStateVarRequest_get_ErrCode(variable) != UPNP_E_SUCCESS) {
|
||||||
if (UpnpString_get_Length(UpnpStateVarRequest_get_ErrStr(variable)) > 0) {
|
if (UpnpString_get_Length(UpnpStateVarRequest_get_ErrStr(variable)) > 0) {
|
||||||
err_code = SOAP_INVALID_VAR;
|
|
||||||
err_str = Soap_Invalid_Var;
|
|
||||||
} else {
|
|
||||||
err_code = UpnpStateVarRequest_get_ErrCode(variable);
|
err_code = UpnpStateVarRequest_get_ErrCode(variable);
|
||||||
err_str = UpnpStateVarRequest_get_ErrStr_cstr(variable);
|
err_str = UpnpStateVarRequest_get_ErrStr_cstr(variable);
|
||||||
}
|
}
|
||||||
send_error_response(info, err_code, err_str, request);
|
goto error_handler;
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
/* send response */
|
/* send response */
|
||||||
send_var_query_response(info, UpnpStateVarRequest_get_CurrentVal(variable), request);
|
send_var_query_response(info, UpnpStateVarRequest_get_CurrentVal(variable), request);
|
||||||
|
|
||||||
|
/* error handling and cleanup */
|
||||||
|
error_handler:
|
||||||
UpnpStateVarRequest_delete(variable);
|
UpnpStateVarRequest_delete(variable);
|
||||||
|
if (err_code != 0)
|
||||||
|
send_error_response(info, err_code, err_str, request);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user