Skip to content

Commit 1ab89e1

Browse files
committed
Fix valgrind warnings
Duplicate (MAKE_STD_ZVAL + ZVAL_ZVAL) params in php7 compatible implementation of call_user_function.
1 parent b624a8b commit 1ab89e1

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

common.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,13 +242,19 @@ inline_call_user_function(HashTable *function_table, zval *object, zval *functio
242242
if (!params) param_count = 0;
243243
if (param_count > 0) {
244244
_params = ecalloc(param_count, sizeof(zval *));
245-
for (i = 0; i < param_count; i++) {
246-
_params[i] = &params[i];
247-
INIT_PZVAL(_params[i]);
245+
for (i = 0; i < param_count; ++i) {
246+
zval *zv = &params[i];
247+
MAKE_STD_ZVAL(_params[i]);
248+
ZVAL_ZVAL(_params[i], zv, 1, 0);
248249
}
249250
}
250251
ret = _call_user_function(function_table, &object, function_name, retval_ptr, param_count, _params TSRMLS_CC);
251-
if (_params) efree(_params);
252+
if (_params) {
253+
for (i = 0; i < param_count; ++i) {
254+
zval_ptr_dtor(&_params[i]);
255+
}
256+
efree(_params);
257+
}
252258
return ret;
253259
}
254260

0 commit comments

Comments
 (0)