]> granicus.if.org Git - php/commitdiff
Fixed bug #25109 (Possible crash when fetching field name)
authorIlia Alshanetsky <iliaa@php.net>
Thu, 28 Aug 2003 00:31:36 +0000 (00:31 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 28 Aug 2003 00:31:36 +0000 (00:31 +0000)
ext/pgsql/pgsql.c

index b20aceab7f7df8bb970dd90ae08a3893d07e8d12..9d0f57e704e553d22102c4c35ffa9511bf26984a 100644 (file)
@@ -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;
                }