From 306a51951f460abc3a7ebf4d196474d4c041b87e Mon Sep 17 00:00:00 2001 From: Niels Dossche <7771979+nielsdos@users.noreply.github.com> Date: Wed, 11 Sep 2024 23:50:53 +0200 Subject: [PATCH] Avoid allocating memory in soap get_function() (#15843) --- ext/soap/soap.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/ext/soap/soap.c b/ext/soap/soap.c index 5f0a661ecba51..02ff10ae4d93a 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -4176,18 +4176,13 @@ static sdlFunctionPtr get_function(sdlPtr sdl, const char *function_name, size_t { sdlFunctionPtr tmp; - char *str = estrndup(function_name, function_name_length); - zend_str_tolower(str, function_name_length); if (sdl != NULL) { - if ((tmp = zend_hash_str_find_ptr(&sdl->functions, str, function_name_length)) != NULL) { - efree(str); + if ((tmp = zend_hash_str_find_ptr_lc(&sdl->functions, function_name, function_name_length)) != NULL) { return tmp; - } else if (sdl->requests != NULL && (tmp = zend_hash_str_find_ptr(sdl->requests, str, function_name_length)) != NULL) { - efree(str); + } else if (sdl->requests != NULL && (tmp = zend_hash_str_find_ptr_lc(sdl->requests, function_name, function_name_length)) != NULL) { return tmp; } } - efree(str); return NULL; } /* }}} */