diff --git a/ext/session/mod_user.c b/ext/session/mod_user.c index 168c5c7f1d44..78fb6260540a 100644 --- a/ext/session/mod_user.c +++ b/ext/session/mod_user.c @@ -218,6 +218,7 @@ PS_GC_FUNC(user) /* Anything else is some kind of error */ *nrdels = -1; // Error } + zval_ptr_dtor(&retval); return *nrdels; } diff --git a/ext/session/tests/user_session_module/gh_gc_retval_leak.phpt b/ext/session/tests/user_session_module/gh_gc_retval_leak.phpt new file mode 100644 index 000000000000..a1eb748df7ac --- /dev/null +++ b/ext/session/tests/user_session_module/gh_gc_retval_leak.phpt @@ -0,0 +1,33 @@ +--TEST-- +session_gc(): user handler returning non-bool/non-int does not leak memory +--INI-- +session.gc_probability=0 +session.save_handler=files +--EXTENSIONS-- +session +--FILE-- + +--EXPECTF-- + +Deprecated: session_set_save_handler(): Providing individual callbacks instead of an object implementing SessionHandlerInterface is deprecated in %s on line %d +bool(false)