Hi list,

I found a memory leak in the pgsql driver that is not fixed in CVS.
Here is a patch:

--- drivers/pgsql/dbd_pgsql.c.orig      2006-09-20 12:07:39.000000000 +0200
+++ drivers/pgsql/dbd_pgsql.c   2006-09-20 12:35:06.000000000 +0200
@@ -543,8 +543,10 @@

  int dbd_ping(dbi_conn_t *conn) {
         PGconn *pgsql = (PGconn *)conn->connection;
+       PGresult *res;

-       PQexec(pgsql, "SELECT 1");
+       res = PQexec(pgsql, "SELECT 1");
+       if (res) PQclear (res);

         if (PQstatus(pgsql) == CONNECTION_OK) {
                 return 1;



In addition, it would be nice if you could incorporate the following 
patch, as this makes the pgsql driver compatible with the Redhat 9 
supplied postgresql 7.3 (yes it is old, but it is still used by NASA for 
the project I am working on):

--- drivers/pgsql/dbd_pgsql.c.orig      2006-08-24 09:59:36.000000000 +0200
+++ drivers/pgsql/dbd_pgsql.c   2006-08-24 09:59:50.000000000 +0200
@@ -38,6 +38,12 @@
  long long strtoll(const char *nptr, char **endptr, int base);
  #endif

+/* In 7.4 PQfreeNotify was deprecated and PQfreemem is used instead.  A
+   macro exists in 7.4 for backwards compatibility. */
+#ifndef PQfreeNotify   /* must be earlier than 7.4 */
+#define PQfreemem PQfreeNotify
+#endif
+
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Libdbi-drivers-devel mailing list
Libdbi-drivers-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libdbi-drivers-devel

Reply via email to