mirror of
https://github.com/php/php-src.git
synced 2026-04-17 13:01:02 +02:00
Fixed memory leak, when invalid context is specified.
This commit is contained in:
@@ -669,10 +669,10 @@ static int parse_context_options(php_stream_context *context, zval *options)
|
||||
|
||||
static int parse_context_params(php_stream_context *context, zval *params)
|
||||
{
|
||||
int ret = SUCCESS;
|
||||
int ret = FAILURE;
|
||||
zval **tmp;
|
||||
|
||||
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "notification", sizeof("notification"), (void**)&tmp)) {
|
||||
if ((ret = zend_hash_find(Z_ARRVAL_P(params), "notification", sizeof("notification"), (void**)&tmp)) == SUCCESS) {
|
||||
|
||||
if (context->notifier) {
|
||||
php_stream_notification_free(context->notifier);
|
||||
@@ -684,10 +684,14 @@ static int parse_context_params(php_stream_context *context, zval *params)
|
||||
context->notifier->ptr = *tmp;
|
||||
ZVAL_ADDREF(*tmp);
|
||||
}
|
||||
if (SUCCESS == zend_hash_find(Z_ARRVAL_P(params), "options", sizeof("options"), (void**)&tmp)) {
|
||||
if ((ret = zend_hash_find(Z_ARRVAL_P(params), "options", sizeof("options"), (void**)&tmp)) == SUCCESS) {
|
||||
parse_context_options(context, *tmp);
|
||||
}
|
||||
|
||||
|
||||
if (ret != SUCCESS) {
|
||||
php_stream_context_free(context);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user