summaryrefslogtreecommitdiff
path: root/src/exchangedb
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-06-11 18:22:33 +0200
committerChristian Grothoff <christian@grothoff.org>2016-06-11 18:22:33 +0200
commit766fb6e2821dc84ccfe290e8906f12001e34043b (patch)
tree6db1e23ca9402076b9390a662b79f101ec58f750 /src/exchangedb
parentf4b013b3d467f93482a00b208acf3a2874362fe7 (diff)
downloadexchange-766fb6e2821dc84ccfe290e8906f12001e34043b.tar.gz
exchange-766fb6e2821dc84ccfe290e8906f12001e34043b.tar.bz2
exchange-766fb6e2821dc84ccfe290e8906f12001e34043b.zip
fixing more leaks
Diffstat (limited to 'src/exchangedb')
-rw-r--r--src/exchangedb/plugin_exchangedb_common.c12
-rw-r--r--src/exchangedb/plugin_exchangedb_postgres.c26
-rw-r--r--src/exchangedb/test_exchangedb.c5
3 files changed, 37 insertions, 6 deletions
diff --git a/src/exchangedb/plugin_exchangedb_common.c b/src/exchangedb/plugin_exchangedb_common.c
index 3bf9bda32..2c3cafe10 100644
--- a/src/exchangedb/plugin_exchangedb_common.c
+++ b/src/exchangedb/plugin_exchangedb_common.c
@@ -75,6 +75,10 @@ common_free_link_data_list (void *cls,
while (NULL != ldl)
{
next = ldl->next;
+ if (NULL != ldl->denom_pub.rsa_public_key)
+ GNUNET_CRYPTO_rsa_public_key_free (ldl->denom_pub.rsa_public_key);
+ if (NULL != ldl->ev_sig.rsa_signature)
+ GNUNET_CRYPTO_rsa_signature_free (ldl->ev_sig.rsa_signature);
GNUNET_free (ldl);
ldl = next;
}
@@ -108,9 +112,17 @@ common_free_coin_transaction_list (void *cls,
GNUNET_free (list->details.deposit);
break;
case TALER_EXCHANGEDB_TT_REFRESH_MELT:
+ if (NULL != list->details.melt->coin.denom_pub.rsa_public_key)
+ GNUNET_CRYPTO_rsa_public_key_free (list->details.melt->coin.denom_pub.rsa_public_key);
+ if (NULL != list->details.melt->coin.denom_sig.rsa_signature)
+ GNUNET_CRYPTO_rsa_signature_free (list->details.melt->coin.denom_sig.rsa_signature);
GNUNET_free (list->details.melt);
break;
case TALER_EXCHANGEDB_TT_REFUND:
+ if (NULL != list->details.refund->coin.denom_pub.rsa_public_key)
+ GNUNET_CRYPTO_rsa_public_key_free (list->details.refund->coin.denom_pub.rsa_public_key);
+ if (NULL != list->details.refund->coin.denom_sig.rsa_signature)
+ GNUNET_CRYPTO_rsa_signature_free (list->details.refund->coin.denom_sig.rsa_signature);
GNUNET_free (list->details.refund);
break;
}
diff --git a/src/exchangedb/plugin_exchangedb_postgres.c b/src/exchangedb/plugin_exchangedb_postgres.c
index d12f0c92a..fa06059f5 100644
--- a/src/exchangedb/plugin_exchangedb_postgres.c
+++ b/src/exchangedb/plugin_exchangedb_postgres.c
@@ -2568,13 +2568,16 @@ get_known_coin (void *cls,
}
GNUNET_assert (1 == nrows); /* due to primary key */
if (NULL == coin_info)
+ {
+ PQclear (result);
return GNUNET_YES;
+ }
{
struct GNUNET_PQ_ResultSpec rs[] = {
GNUNET_PQ_result_spec_rsa_public_key ("denom_pub",
- &coin_info->denom_pub.rsa_public_key),
+ &coin_info->denom_pub.rsa_public_key),
GNUNET_PQ_result_spec_rsa_signature ("denom_sig",
- &coin_info->denom_sig.rsa_signature),
+ &coin_info->denom_sig.rsa_signature),
GNUNET_PQ_result_spec_end
};
@@ -3339,6 +3342,9 @@ postgres_get_melt_commitment (void *cls,
session_hash,
&rs))
return NULL;
+ /* we don't care about most of 'rs' */
+ GNUNET_CRYPTO_rsa_public_key_free (rs.melt.coin.denom_pub.rsa_public_key);
+ GNUNET_CRYPTO_rsa_signature_free (rs.melt.coin.denom_sig.rsa_signature);
mc = GNUNET_new (struct TALER_EXCHANGEDB_MeltCommitment);
mc->num_newcoins = rs.num_newcoins;
mc->denom_pubs = GNUNET_new_array (mc->num_newcoins,
@@ -3505,6 +3511,7 @@ postgres_get_link_data_list (void *cls,
pos->ev_sig.rsa_signature = sig;
ldl = pos;
}
+ PQclear (result);
return ldl;
}
@@ -3810,10 +3817,11 @@ postgres_get_coin_transactions (void *cls,
tl->next = head;
tl->type = TALER_EXCHANGEDB_TT_REFUND;
tl->details.refund = refund;
- if (GNUNET_SYSERR == get_known_coin (cls,
- session,
- coin_pub,
- &refund->coin))
+ if (GNUNET_SYSERR ==
+ get_known_coin (cls,
+ session,
+ coin_pub,
+ &refund->coin))
{
GNUNET_break (0);
GNUNET_free (refund);
@@ -4310,27 +4318,33 @@ postgres_gc (void *cls)
if (PGRES_COMMAND_OK != PQresultStatus (result))
{
BREAK_DB_ERR (result);
+ PQclear (result);
PQfinish (conn);
return GNUNET_SYSERR;
}
+ PQclear (result);
result = GNUNET_PQ_exec_prepared (conn,
"gc_denominations",
params_time);
if (PGRES_COMMAND_OK != PQresultStatus (result))
{
BREAK_DB_ERR (result);
+ PQclear (result);
PQfinish (conn);
return GNUNET_SYSERR;
}
+ PQclear (result);
result = GNUNET_PQ_exec_prepared (conn,
"gc_reserves",
params_time);
if (PGRES_COMMAND_OK != PQresultStatus (result))
{
BREAK_DB_ERR (result);
+ PQclear (result);
PQfinish (conn);
return GNUNET_SYSERR;
}
+ PQclear (result);
PQfinish (conn);
return GNUNET_OK;
}
diff --git a/src/exchangedb/test_exchangedb.c b/src/exchangedb/test_exchangedb.c
index b03fff313..5d1dba0dc 100644
--- a/src/exchangedb/test_exchangedb.c
+++ b/src/exchangedb/test_exchangedb.c
@@ -434,7 +434,10 @@ test_refresh_commit_coins (struct TALER_EXCHANGEDB_Session *session,
FAILIF (0 != memcmp (a_rlink.coin_priv_enc,
b_rlink.coin_priv_enc,
sizeof (a_rlink.coin_priv_enc)));
+ GNUNET_free (ret_commit_coins[cnt].coin_ev);
}
+ GNUNET_free (ret_commit_coins);
+ ret_commit_coins = NULL;
}
ret = GNUNET_OK;
@@ -781,6 +784,8 @@ test_melting (struct TALER_EXCHANGEDB_Session *session)
ret = GNUNET_OK;
drop:
+ for (cnt=0; cnt < MELT_NEW_COINS; cnt++)
+ GNUNET_CRYPTO_rsa_signature_free (ev_sigs[cnt].rsa_signature);
for (cnt=0;cnt<TALER_CNC_KAPPA;cnt++)
if (NULL != commit_coins[cnt])
{