summaryrefslogtreecommitdiff
path: root/ext/pgsql
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2003-08-28 00:31:36 +0000
committerIlia Alshanetsky <iliaa@php.net>2003-08-28 00:31:36 +0000
commitbf82857475fb7733b0ccfd9425669e2bffc7bee7 (patch)
tree38f63d05c67f6b7fe293da7a3eeb409b21e977ad /ext/pgsql
parente5879a50603a22ef5de3e457aff31ec96b30f83c (diff)
downloadphp-git-bf82857475fb7733b0ccfd9425669e2bffc7bee7.tar.gz
Fixed bug #25109 (Possible crash when fetching field name)
Diffstat (limited to 'ext/pgsql')
-rw-r--r--ext/pgsql/pgsql.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index b20aceab7f..9d0f57e704 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -1203,7 +1203,10 @@ static char *get_field_name(PGconn *pgsql, Oid oid, HashTable *list TSRMLS_DC)
char *tmp_oid, *end_ptr, *tmp_name;
list_entry new_oid_entry;
- if ((result = PQexec(pgsql,"select oid,typname from pg_type")) == NULL) {
+ if ((result = PQexec(pgsql,"select oid,typname from pg_type")) == NULL || PQresultStatus(result) != PGRES_TUPLES_OK) {
+ if (result) {
+ PQclear(result);
+ }
smart_str_free(&str);
return empty_string;
}