aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-06-11 16:59:03 +0200
committerChristian Grothoff <christian@grothoff.org>2016-06-11 16:59:03 +0200
commit6fb30ce46809a1c444b66911ea846b8a3f820ce1 (patch)
treef54752e278d6805f5af841ee7ca8b524cf093d0b
parent63612f4976d34d259f28ca5f92ee1a922268ea7b (diff)
fix memory leaks
-rw-r--r--src/exchange-lib/exchange_api_refresh.c10
-rw-r--r--src/exchange-lib/exchange_api_reserve.c6
-rw-r--r--src/exchange-lib/exchange_api_track_transfer.c4
-rw-r--r--src/exchange-lib/test_exchange_api.c1
4 files changed, 15 insertions, 6 deletions
diff --git a/src/exchange-lib/exchange_api_refresh.c b/src/exchange-lib/exchange_api_refresh.c
index 98c6c086b..9a9c6b7eb 100644
--- a/src/exchange-lib/exchange_api_refresh.c
+++ b/src/exchange-lib/exchange_api_refresh.c
@@ -1563,14 +1563,14 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh,
{
unsigned int i;
json_t *jsona;
- struct GNUNET_JSON_Specification spec[] = {
+ struct GNUNET_JSON_Specification outer_spec[] = {
GNUNET_JSON_spec_json ("ev_sigs", &jsona),
GNUNET_JSON_spec_end()
};
if (GNUNET_OK !=
GNUNET_JSON_parse (json,
- spec,
+ outer_spec,
NULL, NULL))
{
GNUNET_break_op (0);
@@ -1580,12 +1580,14 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh,
{
/* We expected an array of coins */
GNUNET_break_op (0);
+ GNUNET_JSON_parse_free (outer_spec);
return GNUNET_SYSERR;
}
if (rrh->md->num_fresh_coins != json_array_size (jsona))
{
/* Number of coins generated does not match our expectation */
GNUNET_break_op (0);
+ GNUNET_JSON_parse_free (outer_spec);
return GNUNET_SYSERR;
}
for (i=0;i<rrh->md->num_fresh_coins;i++)
@@ -1597,7 +1599,6 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh,
struct GNUNET_CRYPTO_RsaSignature *sig;
struct TALER_CoinSpendPublicKeyP coin_pub;
struct GNUNET_HashCode coin_hash;
-
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_rsa_signature ("ev_sig", &blind_sig),
GNUNET_JSON_spec_end()
@@ -1614,6 +1615,7 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh,
NULL, NULL))
{
GNUNET_break_op (0);
+ GNUNET_JSON_parse_free (outer_spec);
return GNUNET_SYSERR;
}
@@ -1637,11 +1639,13 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh,
{
GNUNET_break_op (0);
GNUNET_CRYPTO_rsa_signature_free (sig);
+ GNUNET_JSON_parse_free (outer_spec);
return GNUNET_SYSERR;
}
coin_privs[i] = fc->coin_priv;
sigs[i].rsa_signature = sig;
}
+ GNUNET_JSON_parse_free (outer_spec);
return GNUNET_OK;
}
diff --git a/src/exchange-lib/exchange_api_reserve.c b/src/exchange-lib/exchange_api_reserve.c
index 2b07223af..926157a86 100644
--- a/src/exchange-lib/exchange_api_reserve.c
+++ b/src/exchange-lib/exchange_api_reserve.c
@@ -115,7 +115,7 @@ parse_reserve_history (const json_t *history,
struct GNUNET_JSON_Specification hist_spec[] = {
GNUNET_JSON_spec_string ("type", &type),
TALER_JSON_spec_amount ("amount",
- &amount),
+ &amount),
/* 'wire' and 'signature' are optional depending on 'type'! */
GNUNET_JSON_spec_end()
};
@@ -185,9 +185,9 @@ parse_reserve_history (const json_t *history,
struct TALER_Amount amount_from_purpose;
struct GNUNET_JSON_Specification withdraw_spec[] = {
GNUNET_JSON_spec_fixed_auto ("signature",
- &sig),
+ &sig),
GNUNET_JSON_spec_fixed_auto ("details",
- &withdraw_purpose),
+ &withdraw_purpose),
GNUNET_JSON_spec_end()
};
unsigned int i;
diff --git a/src/exchange-lib/exchange_api_track_transfer.c b/src/exchange-lib/exchange_api_track_transfer.c
index 417d065f0..4cfd07361 100644
--- a/src/exchange-lib/exchange_api_track_transfer.c
+++ b/src/exchange-lib/exchange_api_track_transfer.c
@@ -138,6 +138,7 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh
{
GNUNET_break_op (0);
GNUNET_CRYPTO_hash_context_abort (hash_context);
+ GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
/* build up big hash for signature checking later */
@@ -166,6 +167,7 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh
&exchange_pub))
{
GNUNET_break_op (0);
+ GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
@@ -173,6 +175,7 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh
&exchange_pub))
{
GNUNET_break_op (0);
+ GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
wdh->cb (wdh->cb_cls,
@@ -184,6 +187,7 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh
num_details,
details);
}
+ GNUNET_JSON_parse_free (spec);
TALER_EXCHANGE_track_transfer_cancel (wdh);
return GNUNET_OK;
}
diff --git a/src/exchange-lib/test_exchange_api.c b/src/exchange-lib/test_exchange_api.c
index acd087039..337fd297b 100644
--- a/src/exchange-lib/test_exchange_api.c
+++ b/src/exchange-lib/test_exchange_api.c
@@ -1915,6 +1915,7 @@ interpreter_run (void *cls)
}
TALER_JSON_hash (contract,
&h_contract);
+ json_decref (contract);
wire = json_loads (cmd->details.deposit.wire_details,
JSON_REJECT_DUPLICATES,
NULL);