Skip to content

Commit

Permalink
Avoid allocating memory in soap get_function() (#15843)
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsdos authored Sep 11, 2024
1 parent 81d580e commit 306a519
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions ext/soap/soap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
/* }}} */
Expand Down

0 comments on commit 306a519

Please sign in to comment.