Merge branch 'master' of ssh://taler.net/var/git/exchange

This commit is contained in:
Marcello Stanisci 2016-06-11 18:03:30 +02:00
commit 23c6dba981
8 changed files with 35 additions and 6 deletions

View File

@ -192,6 +192,15 @@ TALER_FAKEBANK_check_empty (struct TALER_FAKEBANK_Handle *h)
void void
TALER_FAKEBANK_stop (struct TALER_FAKEBANK_Handle *h) TALER_FAKEBANK_stop (struct TALER_FAKEBANK_Handle *h)
{ {
struct Transaction *t;
while (NULL != (t = h->transactions_head))
{
GNUNET_CONTAINER_DLL_remove (h->transactions_head,
h->transactions_tail,
t);
GNUNET_free (t);
}
if (NULL != h->mhd_task) if (NULL != h->mhd_task)
{ {
GNUNET_SCHEDULER_cancel (h->mhd_task); GNUNET_SCHEDULER_cancel (h->mhd_task);

View File

@ -1563,14 +1563,14 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh,
{ {
unsigned int i; unsigned int i;
json_t *jsona; json_t *jsona;
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification outer_spec[] = {
GNUNET_JSON_spec_json ("ev_sigs", &jsona), GNUNET_JSON_spec_json ("ev_sigs", &jsona),
GNUNET_JSON_spec_end() GNUNET_JSON_spec_end()
}; };
if (GNUNET_OK != if (GNUNET_OK !=
GNUNET_JSON_parse (json, GNUNET_JSON_parse (json,
spec, outer_spec,
NULL, NULL)) NULL, NULL))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
@ -1580,12 +1580,14 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh,
{ {
/* We expected an array of coins */ /* We expected an array of coins */
GNUNET_break_op (0); GNUNET_break_op (0);
GNUNET_JSON_parse_free (outer_spec);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (rrh->md->num_fresh_coins != json_array_size (jsona)) if (rrh->md->num_fresh_coins != json_array_size (jsona))
{ {
/* Number of coins generated does not match our expectation */ /* Number of coins generated does not match our expectation */
GNUNET_break_op (0); GNUNET_break_op (0);
GNUNET_JSON_parse_free (outer_spec);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
for (i=0;i<rrh->md->num_fresh_coins;i++) 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 GNUNET_CRYPTO_RsaSignature *sig;
struct TALER_CoinSpendPublicKeyP coin_pub; struct TALER_CoinSpendPublicKeyP coin_pub;
struct GNUNET_HashCode coin_hash; struct GNUNET_HashCode coin_hash;
struct GNUNET_JSON_Specification spec[] = { struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_rsa_signature ("ev_sig", &blind_sig), GNUNET_JSON_spec_rsa_signature ("ev_sig", &blind_sig),
GNUNET_JSON_spec_end() GNUNET_JSON_spec_end()
@ -1614,6 +1615,7 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh,
NULL, NULL)) NULL, NULL))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
GNUNET_JSON_parse_free (outer_spec);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -1637,11 +1639,13 @@ refresh_reveal_ok (struct TALER_EXCHANGE_RefreshRevealHandle *rrh,
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
GNUNET_CRYPTO_rsa_signature_free (sig); GNUNET_CRYPTO_rsa_signature_free (sig);
GNUNET_JSON_parse_free (outer_spec);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
coin_privs[i] = fc->coin_priv; coin_privs[i] = fc->coin_priv;
sigs[i].rsa_signature = sig; sigs[i].rsa_signature = sig;
} }
GNUNET_JSON_parse_free (outer_spec);
return GNUNET_OK; return GNUNET_OK;
} }

View File

@ -115,7 +115,7 @@ parse_reserve_history (const json_t *history,
struct GNUNET_JSON_Specification hist_spec[] = { struct GNUNET_JSON_Specification hist_spec[] = {
GNUNET_JSON_spec_string ("type", &type), GNUNET_JSON_spec_string ("type", &type),
TALER_JSON_spec_amount ("amount", TALER_JSON_spec_amount ("amount",
&amount), &amount),
/* 'wire' and 'signature' are optional depending on 'type'! */ /* 'wire' and 'signature' are optional depending on 'type'! */
GNUNET_JSON_spec_end() GNUNET_JSON_spec_end()
}; };
@ -185,9 +185,9 @@ parse_reserve_history (const json_t *history,
struct TALER_Amount amount_from_purpose; struct TALER_Amount amount_from_purpose;
struct GNUNET_JSON_Specification withdraw_spec[] = { struct GNUNET_JSON_Specification withdraw_spec[] = {
GNUNET_JSON_spec_fixed_auto ("signature", GNUNET_JSON_spec_fixed_auto ("signature",
&sig), &sig),
GNUNET_JSON_spec_fixed_auto ("details", GNUNET_JSON_spec_fixed_auto ("details",
&withdraw_purpose), &withdraw_purpose),
GNUNET_JSON_spec_end() GNUNET_JSON_spec_end()
}; };
unsigned int i; unsigned int i;

View File

@ -138,6 +138,7 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
GNUNET_CRYPTO_hash_context_abort (hash_context); GNUNET_CRYPTO_hash_context_abort (hash_context);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
/* build up big hash for signature checking later */ /* build up big hash for signature checking later */
@ -166,6 +167,7 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh
&exchange_pub)) &exchange_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (GNUNET_OK != if (GNUNET_OK !=
@ -173,6 +175,7 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh
&exchange_pub)) &exchange_pub))
{ {
GNUNET_break_op (0); GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
wdh->cb (wdh->cb_cls, wdh->cb (wdh->cb_cls,
@ -184,6 +187,7 @@ check_track_transfer_response_ok (struct TALER_EXCHANGE_TrackTransferHandle *wdh
num_details, num_details,
details); details);
} }
GNUNET_JSON_parse_free (spec);
TALER_EXCHANGE_track_transfer_cancel (wdh); TALER_EXCHANGE_track_transfer_cancel (wdh);
return GNUNET_OK; return GNUNET_OK;
} }

View File

@ -1915,6 +1915,7 @@ interpreter_run (void *cls)
} }
TALER_JSON_hash (contract, TALER_JSON_hash (contract,
&h_contract); &h_contract);
json_decref (contract);
wire = json_loads (cmd->details.deposit.wire_details, wire = json_loads (cmd->details.deposit.wire_details,
JSON_REJECT_DUPLICATES, JSON_REJECT_DUPLICATES,
NULL); NULL);

View File

@ -523,6 +523,7 @@ exchange_keys_update_signkeys ()
{ {
fprintf (stderr, fprintf (stderr,
"Failed to create signing key directory\n"); "Failed to create signing key directory\n");
GNUNET_free (signkey_dir);
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
@ -530,6 +531,7 @@ exchange_keys_update_signkeys ()
signkey_duration, signkey_duration,
GNUNET_TIME_UNIT_ZERO /* no overlap for signing keys */, GNUNET_TIME_UNIT_ZERO /* no overlap for signing keys */,
&anchor); &anchor);
GNUNET_free (signkey_dir);
while (anchor.abs_value_us < lookahead_sign_stamp.abs_value_us) while (anchor.abs_value_us < lookahead_sign_stamp.abs_value_us)
{ {

View File

@ -757,6 +757,7 @@ run_aggregation (void *cls)
"Preparing wire transfer of %s to %s\n", "Preparing wire transfer of %s to %s\n",
amount_s, amount_s,
TALER_B2S (&au->merchant_pub)); TALER_B2S (&au->merchant_pub));
GNUNET_free (amount_s);
} }
au->wp = wp; au->wp = wp;
au->ph = wp->wire_plugin->prepare_wire_transfer (wp->wire_plugin->cls, au->ph = wp->wire_plugin->prepare_wire_transfer (wp->wire_plugin->cls,
@ -1095,7 +1096,11 @@ main (int argc,
gettext_noop ("background process that aggregates and executes wire transfers to merchants"), gettext_noop ("background process that aggregates and executes wire transfers to merchants"),
options, options,
&run, NULL)) &run, NULL))
{
GNUNET_free ((void*) argv);
return 1; return 1;
}
GNUNET_free ((void*) argv);
return global_ret; return global_ret;
} }

View File

@ -84,7 +84,11 @@ TALER_config_get_denom (const struct GNUNET_CONFIGURATION_Handle *cfg,
return GNUNET_NO; return GNUNET_NO;
if (GNUNET_OK != TALER_string_to_amount (str, if (GNUNET_OK != TALER_string_to_amount (str,
denom)) denom))
{
GNUNET_free (str);
return GNUNET_SYSERR; return GNUNET_SYSERR;
}
GNUNET_free (str);
return GNUNET_OK; return GNUNET_OK;
} }