aboutsummaryrefslogtreecommitdiff
path: root/src/datastore
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-08-26 09:26:51 +0000
committerChristian Grothoff <christian@grothoff.org>2010-08-26 09:26:51 +0000
commite743ae65c24457fa19823648c4714c837e49bfdd (patch)
treeac3f92cce572e1e7cfa457928a7c8718d7dc2aef /src/datastore
parent9aa22137e2427e1f44c7fca2f30005ba8b22195d (diff)
downloadgnunet-e743ae65c24457fa19823648c4714c837e49bfdd.tar.gz
gnunet-e743ae65c24457fa19823648c4714c837e49bfdd.zip
fix leaks
Diffstat (limited to 'src/datastore')
-rw-r--r--src/datastore/plugin_datastore_postgres.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/datastore/plugin_datastore_postgres.c b/src/datastore/plugin_datastore_postgres.c
index 63a51d095..3b212c98b 100644
--- a/src/datastore/plugin_datastore_postgres.c
+++ b/src/datastore/plugin_datastore_postgres.c
@@ -293,37 +293,39 @@ init_connection (struct Plugin *plugin)
293#if 1 293#if 1
294 ret = PQexec (plugin->dbh, 294 ret = PQexec (plugin->dbh,
295 "ALTER TABLE gn080 ALTER value SET STORAGE EXTERNAL"); 295 "ALTER TABLE gn080 ALTER value SET STORAGE EXTERNAL");
296 if ( (ret == NULL) || 296 if (GNUNET_OK !=
297 ((PQresultStatus (ret) != PGRES_COMMAND_OK) ) )
298 {
299 check_result (plugin, 297 check_result (plugin,
300 ret, PGRES_COMMAND_OK, "ALTER TABLE", "gn080", __LINE__); 298 ret, PGRES_COMMAND_OK,
299 "ALTER TABLE", "gn080", __LINE__))
300 {
301 PQfinish (plugin->dbh); 301 PQfinish (plugin->dbh);
302 plugin->dbh = NULL; 302 plugin->dbh = NULL;
303 return GNUNET_SYSERR; 303 return GNUNET_SYSERR;
304 } 304 }
305 PQclear (ret);
305 ret = PQexec (plugin->dbh, 306 ret = PQexec (plugin->dbh,
306 "ALTER TABLE gn080 ALTER hash SET STORAGE PLAIN"); 307 "ALTER TABLE gn080 ALTER hash SET STORAGE PLAIN");
307 if ( (ret == NULL) || 308 if (GNUNET_OK !=
308 ((PQresultStatus (ret) != PGRES_COMMAND_OK) ) )
309 {
310 check_result (plugin, 309 check_result (plugin,
311 ret, PGRES_COMMAND_OK, "ALTER TABLE", "gn080", __LINE__); 310 ret, PGRES_COMMAND_OK,
311 "ALTER TABLE", "gn080", __LINE__))
312 {
312 PQfinish (plugin->dbh); 313 PQfinish (plugin->dbh);
313 plugin->dbh = NULL; 314 plugin->dbh = NULL;
314 return GNUNET_SYSERR; 315 return GNUNET_SYSERR;
315 } 316 }
317 PQclear (ret);
316 ret = PQexec (plugin->dbh, 318 ret = PQexec (plugin->dbh,
317 "ALTER TABLE gn080 ALTER vhash SET STORAGE PLAIN"); 319 "ALTER TABLE gn080 ALTER vhash SET STORAGE PLAIN");
318 if ( (ret == NULL) || 320 if (GNUNET_OK !=
319 ((PQresultStatus (ret) != PGRES_COMMAND_OK) ) )
320 {
321 check_result (plugin, 321 check_result (plugin,
322 ret, PGRES_COMMAND_OK, "ALTER TABLE", "gn080", __LINE__); 322 ret, PGRES_COMMAND_OK, "ALTER TABLE", "gn080", __LINE__))
323 {
323 PQfinish (plugin->dbh); 324 PQfinish (plugin->dbh);
324 plugin->dbh = NULL; 325 plugin->dbh = NULL;
325 return GNUNET_SYSERR; 326 return GNUNET_SYSERR;
326 } 327 }
328 PQclear (ret);
327#endif 329#endif
328 if ((GNUNET_OK != 330 if ((GNUNET_OK !=
329 pq_prepare (plugin, 331 pq_prepare (plugin,
@@ -587,6 +589,7 @@ postgres_next_request_cont (void *next_cls,
587 nrc->iter (nrc->iter_cls, 589 nrc->iter (nrc->iter_cls,
588 NULL, NULL, 0, NULL, 0, 0, 0, 590 NULL, NULL, 0, NULL, 0, 0, 0,
589 GNUNET_TIME_UNIT_ZERO_ABS, 0); 591 GNUNET_TIME_UNIT_ZERO_ABS, 0);
592 PQclear (res);
590 GNUNET_free (nrc); 593 GNUNET_free (nrc);
591 return; 594 return;
592 } 595 }
@@ -599,6 +602,7 @@ postgres_next_request_cont (void *next_cls,
599 nrc->iter (nrc->iter_cls, 602 nrc->iter (nrc->iter_cls,
600 NULL, NULL, 0, NULL, 0, 0, 0, 603 NULL, NULL, 0, NULL, 0, 0, 0,
601 GNUNET_TIME_UNIT_ZERO_ABS, 0); 604 GNUNET_TIME_UNIT_ZERO_ABS, 0);
605 PQclear (res);
602 GNUNET_free (nrc); 606 GNUNET_free (nrc);
603 return; 607 return;
604 } 608 }
@@ -612,6 +616,7 @@ postgres_next_request_cont (void *next_cls,
612 (size != PQgetlength (res, 0, 6))) 616 (size != PQgetlength (res, 0, 6)))
613 { 617 {
614 GNUNET_break (0); 618 GNUNET_break (0);
619 PQclear (res);
615 delete_by_rowid (plugin, rowid); 620 delete_by_rowid (plugin, rowid);
616 nrc->iter (nrc->iter_cls, 621 nrc->iter (nrc->iter_cls,
617 NULL, NULL, 0, NULL, 0, 0, 0, 622 NULL, NULL, 0, NULL, 0, 0, 0,
@@ -641,6 +646,7 @@ postgres_next_request_cont (void *next_cls,
641 anonymity, 646 anonymity,
642 expiration_time, 647 expiration_time,
643 rowid); 648 rowid);
649 PQclear (res);
644 if (iret == GNUNET_SYSERR) 650 if (iret == GNUNET_SYSERR)
645 return; 651 return;
646 if (iret == GNUNET_NO) 652 if (iret == GNUNET_NO)