-fix mem leaks

This commit is contained in:
Christian Grothoff 2016-04-04 17:40:51 +02:00
parent 0ff76b5abb
commit afb1ab2a11
4 changed files with 30 additions and 16 deletions

View File

@ -472,6 +472,8 @@ run_aggregation (void *cls,
au); au);
if (GNUNET_OK != ret) if (GNUNET_OK != ret)
{ {
if (NULL != au->wire)
json_decref (au->wire);
GNUNET_free (au); GNUNET_free (au);
db_plugin->rollback (db_plugin->cls, db_plugin->rollback (db_plugin->cls,
session); session);
@ -510,6 +512,8 @@ run_aggregation (void *cls,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to execute deposit iteration!\n"); "Failed to execute deposit iteration!\n");
GNUNET_free_non_null (au->additional_rows); GNUNET_free_non_null (au->additional_rows);
if (NULL != au->wire)
json_decref (au->wire);
GNUNET_free (au); GNUNET_free (au);
db_plugin->rollback (db_plugin->cls, db_plugin->rollback (db_plugin->cls,
session); session);
@ -538,6 +542,8 @@ run_aggregation (void *cls,
"Failed to start database transaction!\n"); "Failed to start database transaction!\n");
*global_ret = GNUNET_SYSERR; *global_ret = GNUNET_SYSERR;
GNUNET_free_non_null (au->additional_rows); GNUNET_free_non_null (au->additional_rows);
if (NULL != au->wire)
json_decref (au->wire);
GNUNET_free (au); GNUNET_free (au);
return; return;
} }
@ -564,6 +570,8 @@ run_aggregation (void *cls,
"Failed to commit database transaction!\n"); "Failed to commit database transaction!\n");
} }
GNUNET_free_non_null (au->additional_rows); GNUNET_free_non_null (au->additional_rows);
if (NULL != au->wire)
json_decref (au->wire);
GNUNET_free (au); GNUNET_free (au);
/* start again */ /* start again */
task = GNUNET_SCHEDULER_add_now (&run_aggregation, task = GNUNET_SCHEDULER_add_now (&run_aggregation,
@ -586,6 +594,8 @@ run_aggregation (void *cls,
db_plugin->rollback (db_plugin->cls, db_plugin->rollback (db_plugin->cls,
session); session);
GNUNET_free_non_null (au->additional_rows); GNUNET_free_non_null (au->additional_rows);
if (NULL != au->wire)
json_decref (au->wire);
GNUNET_free (au); GNUNET_free (au);
/* start again */ /* start again */
task = GNUNET_SCHEDULER_add_now (&run_aggregation, task = GNUNET_SCHEDULER_add_now (&run_aggregation,
@ -625,6 +635,8 @@ prepare_cb (void *cls,
struct TALER_EXCHANGEDB_Session *session = au->session; struct TALER_EXCHANGEDB_Session *session = au->session;
GNUNET_free_non_null (au->additional_rows); GNUNET_free_non_null (au->additional_rows);
if (NULL != au->wire)
json_decref (au->wire);
GNUNET_free (au); GNUNET_free (au);
if (NULL == buf) if (NULL == buf)
{ {

View File

@ -1480,8 +1480,8 @@ postgres_get_denomination_info (void *cls,
EXITIF (GNUNET_OK != EXITIF (GNUNET_OK !=
GNUNET_PQ_extract_result (result, GNUNET_PQ_extract_result (result,
rs, rs,
0)); 0));
} }
PQclear (result); PQclear (result);
return GNUNET_OK; return GNUNET_OK;
@ -1954,7 +1954,7 @@ postgres_get_reserve_history (void *cls,
&bt->wire), &bt->wire),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
if (GNUNET_YES != if (GNUNET_OK !=
GNUNET_PQ_extract_result (result, rs, --rows)) GNUNET_PQ_extract_result (result, rs, --rows))
{ {
GNUNET_break (0); GNUNET_break (0);
@ -2019,7 +2019,7 @@ postgres_get_reserve_history (void *cls,
&cbc->withdraw_fee), &cbc->withdraw_fee),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
if (GNUNET_YES != if (GNUNET_OK !=
GNUNET_PQ_extract_result (result, rs, --rows)) GNUNET_PQ_extract_result (result, rs, --rows))
{ {
GNUNET_break (0); GNUNET_break (0);
@ -2285,6 +2285,7 @@ postgres_get_ready_deposit (void *cls,
&wire), &wire),
GNUNET_PQ_result_spec_end GNUNET_PQ_result_spec_end
}; };
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_PQ_extract_result (result, rs, 0)) GNUNET_PQ_extract_result (result, rs, 0))
{ {

View File

@ -731,20 +731,20 @@ libtaler_plugin_wire_sepa_init (void *cls)
sc = GNUNET_new (struct SepaClosure); sc = GNUNET_new (struct SepaClosure);
if (NULL != cfg) if (NULL != cfg)
{
if (GNUNET_OK !=
GNUNET_CONFIGURATION_get_value_string (cfg,
"exchange",
"CURRENCY",
&sc->currency))
{ {
if (GNUNET_OK != GNUNET_log_config_missing (GNUNET_ERROR_TYPE_ERROR,
GNUNET_CONFIGURATION_get_value_string (cfg, "exchange",
"exchange", "CURRENCY");
"CURRENCY", GNUNET_free (sc);
&sc->currency)) 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 = GNUNET_new (struct TALER_WIRE_Plugin);
plugin->cls = sc; plugin->cls = sc;
plugin->amount_round = &sepa_amount_round; plugin->amount_round = &sepa_amount_round;

View File

@ -762,6 +762,7 @@ libtaler_plugin_wire_test_init (void *cls)
return NULL; return NULL;
} }
tc->bank = TALER_BANK_init (uri); tc->bank = TALER_BANK_init (uri);
GNUNET_free (uri);
if (NULL == tc->bank) if (NULL == tc->bank)
{ {
GNUNET_break (0); GNUNET_break (0);