Memory Leak in pgsql.c
| From: | Dominic J. Eidson | Date: | Fri, 10 Sep 1999 02:34:38 +0000 |
| Subject: | Memory Leak in pgsql.c | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-10789@lists.php.net to get a copy of this message | ||
There is a bug on bugs.php.net (ID 2008), reporting a memory leak in
pgsql.c line 915 - I also found this, and in the latest CVS code it is at
line 919 (element = safe_estrndup(element,element_len);).
Below is the fix (at least it gets rid of the memory leak warning).
Index: php4/ext/pgsql/pgsql.c
===================================================================
RCS file: /repository/php4/ext/pgsql/pgsql.c,v
retrieving revision 1.17
diff -u -r1.17 pgsql.c
--- php4/ext/pgsql/pgsql.c 1999/09/04 13:18:55 1.17
+++ php4/ext/pgsql/pgsql.c 1999/09/10 02:27:10
@@ -940,6 +940,7 @@
field_name = PQfname(pgsql_result,i);
add_assoc_stringl(return_value, field_name, data, data_len, should_copy);
}
+ efree(element);
} else {
/* NULL field, don't set it */
/* add_get_index_stringl(return_value, i, empty_string, 0, (void **) &pval_ptr); */
--
Dominic J. Eidson
"Baruk Khazad! Khazad ai-menu!" - Gimli
--------------------------------------------------------------------------------
http://www.the-infinite.org/ http://www.the-infinite.org/~dominic/