Skip to content

Commit 44f5d81

Browse files
committed
fix: pgsqlSetNoticeCallback: potential memory leak
Discard non-null result of callback.
1 parent 7492232 commit 44f5d81

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
@@ -112,7 +112,9 @@ static void _pdo_pgsql_notice(pdo_dbh_t *dbh, const char *message) /* {{{ */
112112
fc->fci.param_count = 1;
113113
fc->fci.params = &zarg;
114114
fc->fci.retval = &retval;
115-
ret = zend_call_function(&fc->fci, &fc->fcc TSRMLS_CC);
115+
if ((ret = zend_call_function(&fc->fci, &fc->fcc TSRMLS_CC)) != FAILURE) {
116+
zval_ptr_dtor(&retval);
117+
}
116118
zval_ptr_dtor(&zarg);
117119
if (ret == FAILURE) {
118120
pdo_raise_impl_error(dbh, NULL, "HY000", "could not call user-supplied function" TSRMLS_CC);

0 commit comments

Comments
 (0)