CVS update: php3/functions
| From: | sas | Date: | Sun, 20 Jun 1999 16:30:47 +0000 |
| Subject: | CVS update: php3/functions | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-7243@lists.php.net to get a copy of this message | ||
Date: Sunday June 20, 1999 @ 12:30
Author: sas
Update of /repository/php3/functions
In directory php:/tmp/cvs-serv25535
Modified Files:
pgsql.c
Log Message:
This should fix a longstanding bug - a malloc'ed string was
inserted into the hashtable passed back as return_value.
Index: php3/functions/pgsql.c
diff -u php3/functions/pgsql.c:1.84 php3/functions/pgsql.c:1.85
--- php3/functions/pgsql.c:1.84 Thu May 27 11:00:50 1999
+++ php3/functions/pgsql.c Sun Jun 20 12:30:47 1999
@@ -28,7 +28,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql.c,v 1.84 1999/05/27 15:00:50 steinm Exp $ */
+/* $Id: pgsql.c,v 1.85 1999/06/20 16:30:47 sas Exp $ */
#include <stdlib.h>
@@ -957,6 +957,7 @@
array_init(return_value);
for (i=0,num_fields=PQnfields(pgsql_result); i<num_fields; i++) {
char *tmp;
+ int len;
element = PQgetvalue(pgsql_result,row->value.lval,i);
if (element) {
@@ -973,7 +974,9 @@
add_get_index_stringl(return_value, i, tmp, element_len, (void **) &pval_ptr, 0);
field_name = PQfname(pgsql_result, i);
- _php3_hash_pointer_update(return_value->value.ht, field_name, strlen(field_name)+1, pval_ptr);
+ len = strlen(field_name);
+ _php3_hash_pointer_update(return_value->value.ht, estrndup(field_name, len), len+1, pval_ptr);
+ free(field_name);
}
}