From: Felipe Pena Date: Fri, 10 Dec 2010 17:50:26 +0000 (+0000) Subject: - Fixed bug #53517 (segfault in pgsql_stmt_execute() when postgres is down) X-Git-Tag: php-5.4.0alpha1~191^2~535 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3c8bc996dfebb72ea9e30d9ea1904724d849f58b;p=php - Fixed bug #53517 (segfault in pgsql_stmt_execute() when postgres is down) patch by: gyp at balabit dot hu --- diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index b0829452f6..6380acbfc1 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -184,7 +184,7 @@ stmt_retry: * chance to DEALLOCATE the prepared statements it has created. so, if we hit a 42P05 we * deallocate it and retry ONCE (thies 2005.12.15) */ - if (!strcmp(sqlstate, "42P05")) { + if (sqlstate && !strcmp(sqlstate, "42P05")) { char buf[100]; /* stmt_name == "pdo_crsr_%08x" */ PGresult *res; snprintf(buf, sizeof(buf), "DEALLOCATE %s", S->stmt_name);