gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r12737 - gnunet/src/datastore


From: gnunet
Subject: [GNUnet-SVN] r12737 - gnunet/src/datastore
Date: Thu, 26 Aug 2010 11:26:52 +0200

Author: grothoff
Date: 2010-08-26 11:26:51 +0200 (Thu, 26 Aug 2010)
New Revision: 12737

Modified:
   gnunet/src/datastore/plugin_datastore_postgres.c
Log:
fix leaks

Modified: gnunet/src/datastore/plugin_datastore_postgres.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_postgres.c    2010-08-26 07:06:48 UTC 
(rev 12736)
+++ gnunet/src/datastore/plugin_datastore_postgres.c    2010-08-26 09:26:51 UTC 
(rev 12737)
@@ -293,37 +293,39 @@
 #if 1
   ret = PQexec (plugin->dbh,
                 "ALTER TABLE gn080 ALTER value SET STORAGE EXTERNAL");
-  if ( (ret == NULL) || 
-       ((PQresultStatus (ret) != PGRES_COMMAND_OK) ) )
+  if (GNUNET_OK != 
+      check_result (plugin,
+                   ret, PGRES_COMMAND_OK,
+                   "ALTER TABLE", "gn080", __LINE__))
     {
-      check_result (plugin,
-                   ret, PGRES_COMMAND_OK, "ALTER TABLE", "gn080", __LINE__);
       PQfinish (plugin->dbh);
       plugin->dbh = NULL;
       return GNUNET_SYSERR;
     }
+  PQclear (ret);
   ret = PQexec (plugin->dbh,
                 "ALTER TABLE gn080 ALTER hash SET STORAGE PLAIN");
-  if ( (ret == NULL) ||
-       ((PQresultStatus (ret) != PGRES_COMMAND_OK) ) )
+  if (GNUNET_OK !=
+      check_result (plugin,
+                   ret, PGRES_COMMAND_OK,
+                   "ALTER TABLE", "gn080", __LINE__))
     {
-      check_result (plugin,
-                   ret, PGRES_COMMAND_OK, "ALTER TABLE", "gn080", __LINE__);
       PQfinish (plugin->dbh);
       plugin->dbh = NULL;
       return GNUNET_SYSERR;
     }
+  PQclear (ret);
   ret = PQexec (plugin->dbh,
                 "ALTER TABLE gn080 ALTER vhash SET STORAGE PLAIN");
-  if ( (ret == NULL) || 
-       ((PQresultStatus (ret) != PGRES_COMMAND_OK) ) )
+  if (GNUNET_OK !=
+      check_result (plugin,
+                   ret, PGRES_COMMAND_OK, "ALTER TABLE", "gn080", __LINE__))
     {
-      check_result (plugin,
-                   ret, PGRES_COMMAND_OK, "ALTER TABLE", "gn080", __LINE__);
       PQfinish (plugin->dbh);
       plugin->dbh = NULL;
       return GNUNET_SYSERR;
     }
+  PQclear (ret);
 #endif
   if ((GNUNET_OK !=
        pq_prepare (plugin,
@@ -587,6 +589,7 @@
       nrc->iter (nrc->iter_cls, 
                 NULL, NULL, 0, NULL, 0, 0, 0, 
                 GNUNET_TIME_UNIT_ZERO_ABS, 0);
+      PQclear (res);
       GNUNET_free (nrc);
       return; 
     }
@@ -599,6 +602,7 @@
       nrc->iter (nrc->iter_cls, 
                 NULL, NULL, 0, NULL, 0, 0, 0, 
                 GNUNET_TIME_UNIT_ZERO_ABS, 0);
+      PQclear (res);
       GNUNET_free (nrc);
       return;
     }
@@ -612,6 +616,7 @@
       (size != PQgetlength (res, 0, 6)))
     {
       GNUNET_break (0);
+      PQclear (res);
       delete_by_rowid (plugin, rowid);
       nrc->iter (nrc->iter_cls, 
                 NULL, NULL, 0, NULL, 0, 0, 0, 
@@ -641,6 +646,7 @@
                    anonymity,
                    expiration_time,
                    rowid);
+  PQclear (res);
   if (iret == GNUNET_SYSERR)
     return;
   if (iret == GNUNET_NO)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]