summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-04-04 17:40:51 +0200
committerChristian Grothoff <christian@grothoff.org>2016-04-04 17:40:51 +0200
commitafb1ab2a116bb0b33b5d23d043222965892e8edf (patch)
tree514a8ff9108872b1d01dc5e28dc5727ca4c6b63d
parent0ff76b5abbf09aa273b7998f4d16bb0c0e4d90bb (diff)
downloadexchange-afb1ab2a116bb0b33b5d23d043222965892e8edf.tar.gz
exchange-afb1ab2a116bb0b33b5d23d043222965892e8edf.tar.bz2
exchange-afb1ab2a116bb0b33b5d23d043222965892e8edf.zip
-fix mem leaks
-rw-r--r--src/exchange/taler-exchange-aggregator.c12
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c9
-rw-r--r--src/wire/plugin_wire_sepa.c24
-rw-r--r--src/wire/plugin_wire_test.c1
4 files changed, 30 insertions, 16 deletions
diff --git a/src/exchange/taler-exchange-aggregator.c b/src/exchange/taler-exchange-aggregator.c
index 2d5fd71d8..a6b7de211 100644
--- a/src/exchange/taler-exchange-aggregator.c
+++ b/src/exchange/taler-exchange-aggregator.c
@@ -472,6 +472,8 @@ run_aggregation (void *cls,
au);
if (GNUNET_OK != ret)
{
+ if (NULL != au->wire)
+ json_decref (au->wire);
GNUNET_free (au);
db_plugin->rollback (db_plugin->cls,
session);
@@ -510,6 +512,8 @@ run_aggregation (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to execute deposit iteration!\n");
GNUNET_free_non_null (au->additional_rows);
+ if (NULL != au->wire)
+ json_decref (au->wire);
GNUNET_free (au);
db_plugin->rollback (db_plugin->cls,
session);
@@ -538,6 +542,8 @@ run_aggregation (void *cls,
"Failed to start database transaction!\n");
*global_ret = GNUNET_SYSERR;
GNUNET_free_non_null (au->additional_rows);
+ if (NULL != au->wire)
+ json_decref (au->wire);
GNUNET_free (au);
return;
}
@@ -564,6 +570,8 @@ run_aggregation (void *cls,
"Failed to commit database transaction!\n");
}
GNUNET_free_non_null (au->additional_rows);
+ if (NULL != au->wire)
+ json_decref (au->wire);
GNUNET_free (au);
/* start again */
task = GNUNET_SCHEDULER_add_now (&run_aggregation,
@@ -586,6 +594,8 @@ run_aggregation (void *cls,
db_plugin->rollback (db_plugin->cls,
session);
GNUNET_free_non_null (au->additional_rows);
+ if (NULL != au->wire)
+ json_decref (au->wire);
GNUNET_free (au);
/* start again */
task = GNUNET_SCHEDULER_add_now (&run_aggregation,
@@ -625,6 +635,8 @@ prepare_cb (void *cls,
struct TALER_EXCHANGEDB_Session *session = au->session;
GNUNET_free_non_null (au->additional_rows);
+ if (NULL != au->wire)
+ json_decref (au->wire);
GNUNET_free (au);
if (NULL == buf)
{
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index b59acaead..6807e7563 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -1480,8 +1480,8 @@ postgres_get_denomination_info (void *cls,
EXITIF (GNUNET_OK !=
GNUNET_PQ_extract_result (result,
- rs,
- 0));
+ rs,
+ 0));
}
PQclear (result);
return GNUNET_OK;
@@ -1954,7 +1954,7 @@ postgres_get_reserve_history (void *cls,
&bt->wire),
GNUNET_PQ_result_spec_end
};
- if (GNUNET_YES !=
+ if (GNUNET_OK !=
GNUNET_PQ_extract_result (result, rs, --rows))
{
GNUNET_break (0);
@@ -2019,7 +2019,7 @@ postgres_get_reserve_history (void *cls,
&cbc->withdraw_fee),
GNUNET_PQ_result_spec_end
};
- if (GNUNET_YES !=
+ if (GNUNET_OK !=
GNUNET_PQ_extract_result (result, rs, --rows))
{
GNUNET_break (0);
@@ -2285,6 +2285,7 @@ postgres_get_ready_deposit (void *cls,
&wire),
GNUNET_PQ_result_spec_end
};
+
if (GNUNET_OK !=
GNUNET_PQ_extract_result (result, rs, 0))
{
diff --git a/src/wire/plugin_wire_sepa.c b/src/wire/plugin_wire_sepa.c
index 466e450be..e0a3426c2 100644
--- a/src/wire/plugin_wire_sepa.c
+++ b/src/wire/plugin_wire_sepa.c
@@ -731,20 +731,20 @@ libtaler_plugin_wire_sepa_init (void *cls)
sc = GNUNET_new (struct SepaClosure);
if (NULL != cfg)
+ {
+ if (GNUNET_OK !=
+ GNUNET_CONFIGURATION_get_value_string (cfg,
+ "exchange",
+ "CURRENCY",
+ &sc->currency))
{
- if (GNUNET_OK !=
- GNUNET_CONFIGURATION_get_value_string (cfg,
- "exchange",
- "CURRENCY",
- &sc->currency))
- {
- GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
- "exchange",
- "CURRENCY");
- GNUNET_free (sc);
- return NULL;
- }
+ GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
+ "exchange",
+ "CURRENCY");
+ GNUNET_free (sc);
+ return NULL;
}
+ }
plugin = GNUNET_new (struct TALER_WIRE_Plugin);
plugin->cls = sc;
plugin->amount_round = &sepa_amount_round;
diff --git a/src/wire/plugin_wire_test.c b/src/wire/plugin_wire_test.c
index 8c03d155e..357449af6 100644
--- a/src/wire/plugin_wire_test.c
+++ b/src/wire/plugin_wire_test.c
@@ -762,6 +762,7 @@ libtaler_plugin_wire_test_init (void *cls)
return NULL;
}
tc->bank = TALER_BANK_init (uri);
+ GNUNET_free (uri);
if (NULL == tc->bank)
{
GNUNET_break (0);