Skip to content

Commit d95976c

Browse files
committed
fix: pgsqlSetNoticeCallback: potential memory leak
Discard non-null result of callback.
1 parent 6252e46 commit d95976c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ext/pdo_pgsql/pgsql_driver.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ static void _pdo_pgsql_notice(pdo_dbh_t *dbh, const char *message) /* {{{ */
120120
fc->fci.param_count = 1;
121121
fc->fci.params = &zarg;
122122
fc->fci.retval = &retval;
123-
ret = zend_call_function(&fc->fci, &fc->fcc TSRMLS_CC);
123+
if ((ret = zend_call_function(&fc->fci, &fc->fcc TSRMLS_CC)) != FAILURE) {
124+
zval_ptr_dtor(&retval);
125+
}
124126
zval_ptr_dtor(&zarg);
125127
if (ret == FAILURE) {
126128
pdo_raise_impl_error(dbh, NULL, "HY000", "could not call user-supplied function" TSRMLS_CC);

0 commit comments

Comments
 (0)