-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);
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)
{

View File

@ -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))
{

View File

@ -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;

View File

@ -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);