ext/pdo_sqlite: createCollation memory leaks fix.

coming from callback arguments when its return type is incorrect.

close GH-18796
This commit is contained in:
David Carlier 2025-06-07 13:31:55 +01:00
parent c772963c9c
commit 1044558b64
No known key found for this signature in database
GPG key ID: 8486F847B4B94EF1
3 changed files with 31 additions and 3 deletions

View file

@ -346,6 +346,9 @@ static int php_sqlite_collation_callback(void *context, int string1_len, const v
zend_call_known_fcc(&collation->callback, &retval, /* argc */ 2, zargs, /* named_params */ NULL);
zval_ptr_dtor(&zargs[0]);
zval_ptr_dtor(&zargs[1]);
if (!Z_ISUNDEF(retval)) {
if (Z_TYPE(retval) != IS_LONG) {
zend_string *func_name = get_active_function_or_method_name();
@ -362,9 +365,6 @@ static int php_sqlite_collation_callback(void *context, int string1_len, const v
}
}
zval_ptr_dtor(&zargs[0]);
zval_ptr_dtor(&zargs[1]);
return ret;
}