fix memory leaks

This commit is contained in:
Christian Grothoff 2016-06-11 16:59:03 +02:00
parent 63612f4976
commit 6fb30ce468
4 changed files with 15 additions and 6 deletions

View File

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

View File

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

View File

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

View File

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