Skip to content

Commit 97d791e

Browse files
committed
ext/pgsql: attempt to fix segfault on module shutdown with persistent resources when removing entries during module's lifetime
1 parent b4e272c commit 97d791e

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

ext/pgsql/pgsql.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,13 @@ static void php_pgsql_set_default_link(zend_object *obj)
307307

308308
static void _close_pgsql_plink(zend_resource *rsrc)
309309
{
310-
PGconn *link = (PGconn *)rsrc->ptr;
310+
PGconn *link;
311311
PGresult *res;
312+
if (!rsrc || !rsrc->ptr) {
313+
return;
314+
}
315+
316+
link = (PGconn *)rsrc->ptr;
312317

313318
while ((res = PQgetResult(link))) {
314319
PQclear(res);

0 commit comments

Comments
 (0)