Skip to content

Commit 9c9bb86

Browse files
committed
Get rid of memory leak
1 parent 14c8005 commit 9c9bb86

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

ext/pgsql/pgsql.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -295,8 +295,6 @@ static inline char * _php_pgsql_trim_result(PGconn * pgsql, char **buf)
295295

296296
static void php_pgsql_set_default_link(zval *link)
297297
{
298-
GC_ADDREF(Z_OBJ_P(link));
299-
300298
if (PGG(default_link) != NULL) {
301299
pgsql_link_free(FETCH_DEFAULT_LINK());
302300
}
@@ -774,7 +772,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
774772

775773
/* add it to the hash */
776774
ZVAL_COPY(&new_index_ptr, return_value);
777-
zend_hash_update_mem(&PGG(regular_list), str.s, (void *) &new_index_ptr, sizeof(zval));
775+
zend_hash_update(&PGG(regular_list), str.s, &new_index_ptr);
778776

779777
/* Keep track of link => hash mapping, so we can remove the hash entry from regular_list
780778
* when the connection is closed. This uses the address of the connection rather than the

0 commit comments

Comments
 (0)