-fix leaks and compiler warnings

This commit is contained in:
Christian Grothoff 2021-11-19 20:56:53 +01:00
parent 7b5eb61370
commit 52fe9d657b
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
21 changed files with 154 additions and 35 deletions

View File

@ -1386,6 +1386,7 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h,
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Currency `%s' does not match our configuration\n",
amount.currency);
json_decref (json);
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_CONFLICT,
@ -1411,6 +1412,7 @@ handle_admin_add_incoming (struct TALER_FAKEBANK_Handle *h,
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
"Reserve public key not unique\n");
json_decref (json);
return TALER_MHD_reply_with_error (
connection,
MHD_HTTP_CONFLICT,

View File

@ -473,6 +473,7 @@ execute_wire_transfer (void)
buf_size,
&confirmation_cb,
NULL);
GNUNET_free (buf);
if (NULL == eh)
{
fprintf (stderr,

View File

@ -375,6 +375,8 @@ check_refresh_reveal_cb (
const struct TALER_TransferPublicKeyP *tpr)
{
(void) cls;
GNUNET_assert (TALER_CNC_KAPPA - 1 == num_tprivs);
/* compare the refresh commit coin arrays */
for (unsigned int cnt = 0; cnt < num_freshcoins; cnt++)
{
@ -433,6 +435,7 @@ audit_refresh_session_cb (void *cls,
(void) cls;
(void) rowid;
(void) denom_pub;
(void) coin_pub;
(void) coin_sig;
(void) amount_with_fee;
(void) noreveal_index;
@ -717,6 +720,16 @@ cb_wt_never (void *cls,
const struct TALER_Amount *coin_value,
const struct TALER_Amount *coin_fee)
{
(void) cls;
(void) serial_id;
(void) merchant_pub;
(void) account_payto_uri;
(void) exec_time;
(void) h_contract_terms;
(void) denom_pub;
(void) coin_pub;
(void) coin_value;
(void) coin_fee;
GNUNET_assert (0); /* this statement should be unreachable */
}
@ -747,6 +760,8 @@ cb_wt_check (void *cls,
const struct TALER_Amount *coin_value,
const struct TALER_Amount *coin_fee)
{
(void) row_id;
(void) denom_pub;
GNUNET_assert (cls == &cb_wt_never);
GNUNET_assert (0 == GNUNET_memcmp (merchant_pub,
&merchant_pub_wt));
@ -890,6 +905,12 @@ audit_deposit_cb (void *cls,
const struct TALER_DenominationPublicKey *denom_pub,
bool done)
{
(void) cls;
(void) rowid;
(void) exchange_timestamp;
(void) deposit;
(void) denom_pub;
(void) done;
auditor_row_cnt++;
return GNUNET_OK;
}
@ -911,7 +932,7 @@ audit_deposit_cb (void *cls,
* @param amount_with_fee amount that was deposited including fee
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/
static int
static enum GNUNET_GenericReturnValue
audit_refund_cb (void *cls,
uint64_t rowid,
const struct TALER_DenominationPublicKey *denom_pub,
@ -948,7 +969,7 @@ audit_refund_cb (void *cls,
* @param execution_date when did we receive the funds
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/
static int
static enum GNUNET_GenericReturnValue
audit_reserve_in_cb (void *cls,
uint64_t rowid,
const struct TALER_ReservePublicKeyP *reserve_pub,
@ -982,7 +1003,7 @@ audit_reserve_in_cb (void *cls,
* @param amount_with_fee amount that was withdrawn
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/
static int
static enum GNUNET_GenericReturnValue
audit_reserve_out_cb (void *cls,
uint64_t rowid,
const struct TALER_BlindedCoinHash *h_blind_ev,
@ -1010,7 +1031,7 @@ audit_reserve_out_cb (void *cls,
*
* @return #GNUNET_OK on success
*/
static int
static enum GNUNET_GenericReturnValue
test_gc (void)
{
struct DenomKeyPair *dkp;
@ -1062,7 +1083,7 @@ test_gc (void)
*
* @return #GNUNET_OK on success
*/
static int
static enum GNUNET_GenericReturnValue
test_wire_fees (void)
{
struct GNUNET_TIME_Absolute start_date;
@ -1171,7 +1192,7 @@ static struct TALER_Amount wire_out_amount;
* @param amount amount that was wired
* @return #GNUNET_OK to continue, #GNUNET_SYSERR to stop iteration
*/
static int
static enum GNUNET_GenericReturnValue
audit_wire_cb (void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute date,
@ -1179,6 +1200,9 @@ audit_wire_cb (void *cls,
const char *payto_uri,
const struct TALER_Amount *amount)
{
(void) cls;
(void) rowid;
(void) payto_uri;
auditor_row_cnt++;
GNUNET_assert (0 ==
TALER_amount_cmp (amount,
@ -1196,7 +1220,7 @@ audit_wire_cb (void *cls,
*
* @return #GNUNET_OK on success
*/
static int
static enum GNUNET_GenericReturnValue
test_wire_out (const struct TALER_EXCHANGEDB_Deposit *deposit)
{
auditor_row_cnt = 0;
@ -1347,7 +1371,7 @@ drop:
* @param coin_blind blinding factor used to blind the coin
* @return #GNUNET_OK to continue to iterate, #GNUNET_SYSERR to stop
*/
static int
static enum GNUNET_GenericReturnValue
recoup_cb (void *cls,
uint64_t rowid,
struct GNUNET_TIME_Absolute timestamp,
@ -1360,6 +1384,10 @@ recoup_cb (void *cls,
{
const union TALER_DenominationBlindingKeyP *cb = cls;
(void) timestamp;
(void) amount;
(void) reserve_pub;
(void) coin_sig;
FAILIF (NULL == cb);
FAILIF (0 != GNUNET_memcmp (cb,
coin_blind));
@ -1666,6 +1694,7 @@ run (void *cls)
TALER_denom_pub_verify (&dkp->pub,
&ds,
&c_hash));
TALER_denom_sig_free (&ds);
}
RND_BLK (&coin_sig);
@ -2197,6 +2226,7 @@ main (int argc,
char *testname;
struct GNUNET_CONFIGURATION_Handle *cfg;
(void) argc;
result = -1;
if (NULL == (plugin_name = strrchr (argv[0], (int) '-')))
{

View File

@ -679,7 +679,7 @@ TALER_EXCHANGE_verify_coin_history (
for the exchange to lie here, so not checking is probably OK
(an auditor ought to check, though). Then again, we similarly
had no reason to check the merchant's signature (other than a
well-formendess check). *///
well-formendess check). */
/* check that refund fee matches our expectations from /keys! */
if (NULL != dk)

View File

@ -198,11 +198,11 @@ serialize_melt_data (const struct MeltData *md)
GNUNET_JSON_pack_data_auto ("ps",
&md->fresh_coins[j][i]));
GNUNET_assert (0 ==
json_array_append (planchet_secrets,
json_array_append_new (planchet_secrets,
ps));
}
GNUNET_assert (0 ==
json_array_append (
json_array_append_new (
fresh_coins,
GNUNET_JSON_PACK (
TALER_JSON_pack_denom_pub ("denom_pub",
@ -299,6 +299,7 @@ TALER_EXCHANGE_deserialize_melt_data_ (const json_t *melt_data,
{
GNUNET_break (0);
ok = false;
GNUNET_JSON_parse_free (ispec);
break;
}
for (unsigned int j = 0; j<TALER_CNC_KAPPA; j++)
@ -320,10 +321,12 @@ TALER_EXCHANGE_deserialize_melt_data_ (const json_t *melt_data,
break;
}
}
json_decref (planchet_secrets);
if (! ok)
break;
}
GNUNET_JSON_parse_free (spec);
if (! ok)
{
TALER_EXCHANGE_free_melt_data_ (md);

View File

@ -166,6 +166,7 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
if (0 == len)
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
have_deposit = false;
@ -191,6 +192,7 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
NULL, NULL))
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if (0 == strcasecmp (type,
@ -205,7 +207,7 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
struct TALER_MerchantPublicKeyP merchant_pub;
struct GNUNET_TIME_Absolute refund_deadline;
struct TALER_CoinSpendSignatureP sig;
struct GNUNET_JSON_Specification spec[] = {
struct GNUNET_JSON_Specification ispec[] = {
GNUNET_JSON_spec_fixed_auto ("coin_sig",
&sig),
GNUNET_JSON_spec_fixed_auto ("h_contract_terms",
@ -227,10 +229,11 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
if (GNUNET_OK !=
GNUNET_JSON_parse (transaction,
spec,
ispec,
NULL, NULL))
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if (GNUNET_OK !=
@ -247,6 +250,7 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&sig))
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if ( (0 != GNUNET_memcmp (&rh->depconf.h_contract_terms,
@ -256,6 +260,7 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
{
/* deposit information is about a different merchant/contract */
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if (have_deposit)
@ -266,6 +271,7 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&dtotal))
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
GNUNET_break (0 <=
@ -290,7 +296,7 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
.purpose.purpose = htonl (TALER_SIGNATURE_MERCHANT_REFUND),
.coin_pub = rh->depconf.coin_pub
};
struct GNUNET_JSON_Specification spec[] = {
struct GNUNET_JSON_Specification ispec[] = {
TALER_JSON_spec_amount_any ("refund_fee",
&refund_fee),
GNUNET_JSON_spec_fixed_auto ("merchant_sig",
@ -306,10 +312,11 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
if (GNUNET_OK !=
GNUNET_JSON_parse (transaction,
spec,
ispec,
NULL, NULL))
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if (0 >
@ -318,6 +325,7 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&amount))
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
TALER_amount_hton (&rr.refund_amount,
@ -330,6 +338,7 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&rr.merchant.eddsa_pub))
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if ( (0 != GNUNET_memcmp (&rh->depconf.h_contract_terms,
@ -339,6 +348,7 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
{
/* refund is about a different merchant/contract */
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if (rr.rtransaction_id == rh->depconf.rtransaction_id)
@ -346,6 +356,7 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
/* Eh, this shows either a dependency failure or idempotency,
but must not happen in a conflict reply. Fail! */
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
@ -356,6 +367,7 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&rtotal))
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
GNUNET_break (0 <=
@ -376,6 +388,7 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
"Unexpected type `%s' in response for exchange refund\n",
type);
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
}
@ -393,6 +406,7 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&amount))
{
GNUNET_break (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
}
@ -405,10 +419,12 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&rtotal))
{
/* dtotal < rtotal: good! */
GNUNET_JSON_parse_free (spec);
return GNUNET_OK;
}
/* this fails to prove a conflict */
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
@ -422,14 +438,15 @@ verify_conflict_history_ok (struct TALER_EXCHANGE_RefundHandle *rh,
* @param json json reply with the signature
* @return #GNUNET_OK if the signature is valid, #GNUNET_SYSERR if not
*/
static int
static enum GNUNET_GenericReturnValue
verify_failed_dependency_ok (struct TALER_EXCHANGE_RefundHandle *rh,
const json_t *json)
{
json_t *h;
json_t *e;
struct GNUNET_JSON_Specification spec[] = {
GNUNET_JSON_spec_json ("history", &h),
GNUNET_JSON_spec_json ("history",
&h),
GNUNET_JSON_spec_end ()
};
@ -445,6 +462,7 @@ verify_failed_dependency_ok (struct TALER_EXCHANGE_RefundHandle *rh,
(1 != json_array_size (h) ) )
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
e = json_array_get (h, 0);
@ -459,7 +477,7 @@ verify_failed_dependency_ok (struct TALER_EXCHANGE_RefundHandle *rh,
.coin_pub = rh->depconf.coin_pub
};
uint64_t rtransaction_id;
struct GNUNET_JSON_Specification spec[] = {
struct GNUNET_JSON_Specification ispec[] = {
TALER_JSON_spec_amount_any ("amount",
&amount),
GNUNET_JSON_spec_string ("type",
@ -479,10 +497,11 @@ verify_failed_dependency_ok (struct TALER_EXCHANGE_RefundHandle *rh,
if (GNUNET_OK !=
GNUNET_JSON_parse (e,
spec,
ispec,
NULL, NULL))
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
rr.rtransaction_id = GNUNET_htonll (rtransaction_id);
@ -495,6 +514,7 @@ verify_failed_dependency_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&rh->depconf.merchant.eddsa_pub))
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
if ( (rr.rtransaction_id != rh->depconf.rtransaction_id) ||
@ -506,9 +526,11 @@ verify_failed_dependency_ok (struct TALER_EXCHANGE_RefundHandle *rh,
&rr.refund_amount)) )
{
GNUNET_break_op (0);
GNUNET_JSON_parse_free (spec);
return GNUNET_SYSERR;
}
}
GNUNET_JSON_parse_free (spec);
return GNUNET_OK;
}

View File

@ -670,6 +670,7 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
(void) cls;
TALER_TESTING_run_with_fakebank (is,
commands,
bc.exchange_auth.wire_gateway_url);
@ -680,6 +681,8 @@ int
main (int argc,
char *const *argv)
{
(void) argc;
(void) argv;
/* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME");

View File

@ -91,6 +91,7 @@ version_cb (void *cls,
const struct TALER_AUDITOR_VersionInformation *vi,
enum TALER_AUDITOR_VersionCompatibility compat)
{
(void) cls;
(void) hr;
if ( (NULL != vi) &&
(TALER_AUDITOR_VC_MATCH == compat) )
@ -134,6 +135,8 @@ main (int argc,
{
struct GNUNET_OS_Process *proc;
(void) argc;
(void) argv;
/* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME");

View File

@ -75,6 +75,7 @@ run (void *cls,
{
struct TALER_WireTransferIdentifierRawP wtid;
(void) cls;
memset (&wtid, 42, sizeof (wtid));
{
@ -165,6 +166,8 @@ main (int argc,
int rv;
const char *cfgfile;
(void) argc;
(void) argv;
/* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME");

View File

@ -86,6 +86,7 @@ run (void *cls,
/* Route our commands through twister. */
struct TALER_BANK_AuthenticationData exchange_auth_twisted;
(void) cls;
memset (&wtid,
0x5a,
sizeof (wtid));
@ -165,6 +166,7 @@ main (int argc,
int ret;
const char *cfgfilename;
(void) argc;
/* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME");

View File

@ -902,6 +902,8 @@ run (void *cls,
struct TALER_TESTING_Command reserve_open_close[(RESERVE_OPEN_CLOSE_ITERATIONS
* RESERVE_OPEN_CLOSE_CHUNK)
+ 1];
(void) cls;
for (unsigned int i = 0;
i < RESERVE_OPEN_CLOSE_ITERATIONS;
i++)
@ -980,6 +982,8 @@ int
main (int argc,
char *const *argv)
{
(void) argc;
(void) argv;
/* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME");

View File

@ -99,6 +99,7 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
(void) cls;
TALER_TESTING_run (is,
commands);
}
@ -108,6 +109,8 @@ int
main (int argc,
char *const *argv)
{
(void) argc;
(void) argv;
/* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME");

View File

@ -79,6 +79,7 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
(void) cls;
TALER_TESTING_run (is,
commands);
}
@ -88,6 +89,8 @@ int
main (int argc,
char *const *argv)
{
(void) argc;
(void) argv;
/* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME");

View File

@ -239,6 +239,7 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
(void) cls;
TALER_TESTING_run_with_fakebank (is,
revocation,
bc.exchange_auth.wire_gateway_url);
@ -249,6 +250,8 @@ int
main (int argc,
char *const *argv)
{
(void) argc;
(void) argv;
/* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME");

View File

@ -155,7 +155,8 @@ run (void *cls,
* NOTE: not all CMDs actually need the twister,
* so it may be better to move those into the "main"
* lib test suite.
*/struct TALER_TESTING_Command refund[] = {
*/
struct TALER_TESTING_Command refund[] = {
CMD_TRANSFER_TO_EXCHANGE ("create-reserve-r1",
"EUR:5.01"),
CMD_EXEC_WIREWATCH ("wirewatch-r1"),
@ -183,7 +184,6 @@ run (void *cls,
MHD_HTTP_FORBIDDEN,
"EUR:5",
"deposit-refund-1"),
/* This next deposit CMD is only used to provide a
* good merchant signature to the next (failing) refund
* operations. */
@ -210,6 +210,7 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
#if 0
/**
* Test that we don't get errors when the keys from the exchange
* are out of date.
@ -234,6 +235,7 @@ run (void *cls,
MHD_HTTP_OK),
TALER_TESTING_cmd_end ()
};
#endif
struct TALER_TESTING_Command commands[] = {
TALER_TESTING_cmd_wire_add ("add-wire-account",
@ -248,11 +250,14 @@ run (void *cls,
refresh_409_conflict),
TALER_TESTING_cmd_batch ("refund",
refund),
#if 0
TALER_TESTING_cmd_batch ("expired-keys",
expired_keys),
#endif
TALER_TESTING_cmd_end ()
};
(void) cls;
TALER_TESTING_run_with_fakebank (is,
commands,
bc.exchange_auth.wire_gateway_url);
@ -280,6 +285,8 @@ main (int argc,
{
int ret;
(void) argc;
(void) argv;
/* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME");

View File

@ -145,6 +145,7 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
(void) cls;
TALER_TESTING_run_with_fakebank (is,
commands,
bc.exchange_auth.wire_gateway_url);
@ -155,6 +156,8 @@ int
main (int argc,
char *const *argv)
{
(void) argc;
(void) argv;
/* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME");

View File

@ -231,6 +231,7 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
(void) cls;
TALER_TESTING_run_with_fakebank (is,
commands,
bc.exchange_auth.wire_gateway_url);
@ -241,6 +242,8 @@ int
main (int argc,
char *const *argv)
{
(void) argc;
(void) argv;
/* These environment variables get in the way... */
unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME");

View File

@ -143,6 +143,7 @@ run (void *cls,
TALER_TESTING_cmd_end ()
};
(void) cls;
TALER_TESTING_run_with_fakebank (is,
all,
bc.exchange_auth.wire_gateway_url);
@ -155,6 +156,7 @@ main (int argc,
{
const char *plugin_name;
(void) argc;
/* these might get in the way */
unsetenv ("XDG_DATA_HOME");
unsetenv ("XDG_CONFIG_HOME");

View File

@ -490,6 +490,7 @@ refresh_reveal_cleanup (void *cls,
{
struct RefreshRevealState *rrs = cls;
(void) cmd;
if (NULL != rrs->rrh)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
@ -741,6 +742,7 @@ refresh_link_run (void *cls,
const struct TALER_TESTING_Command *melt_cmd;
const struct TALER_TESTING_Command *coin_cmd;
(void) cmd;
rls->is = is;
reveal_cmd = TALER_TESTING_interpreter_lookup_command (rls->is,
rls->reveal_reference);
@ -855,6 +857,11 @@ do_melt_retry (void *cls)
rms->retry_task = NULL;
rms->is->commands[rms->is->ip].last_req_time
= GNUNET_TIME_absolute_get ();
if (NULL != rms->refresh_data)
{
json_decref (rms->refresh_data);
rms->refresh_data = NULL;
}
melt_run (rms,
NULL,
rms->is);
@ -880,6 +887,7 @@ melt_cb (void *cls,
{
struct RefreshMeltState *rms = cls;
(void) exchange_pub;
rms->rmh = NULL;
if (rms->expected_response_code != hr->http_status)
{
@ -966,6 +974,7 @@ melt_run (void *cls,
};
const char **melt_fresh_amounts;
(void) cmd;
if (NULL == (melt_fresh_amounts = rms->melt_fresh_amounts))
melt_fresh_amounts = default_melt_fresh_amounts;
rms->is = is;
@ -1029,8 +1038,9 @@ melt_run (void *cls,
{
const struct TALER_EXCHANGE_DenomPublicKey *fresh_pk;
if (GNUNET_OK != TALER_string_to_amount
(melt_fresh_amounts[i], &fresh_amount))
if (GNUNET_OK !=
TALER_string_to_amount (melt_fresh_amounts[i],
&fresh_amount))
{
GNUNET_break (0);
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
@ -1060,7 +1070,8 @@ melt_run (void *cls,
/* Make a deep copy of the RSA key */
TALER_denom_pub_deep_copy (&rms->fresh_pks[i].key,
&fresh_pk->key);
}
} /* end for */
GNUNET_assert (NULL == rms->refresh_data);
rms->refresh_data
= TALER_EXCHANGE_refresh_prepare (rms->melt_priv,
&melt_amount,
@ -1102,6 +1113,7 @@ melt_cleanup (void *cls,
{
struct RefreshMeltState *rms = cls;
(void) cmd;
if (NULL != rms->rmh)
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,

View File

@ -118,6 +118,7 @@ key_cb (void *cls,
const struct TALER_SecurityModulePublicKeyP *sm_pub,
const struct TALER_SecurityModuleSignatureP *sm_sig)
{
(void) cls;
(void) sm_pub;
(void) sm_sig;
if (0 == validity_duration.rel_value_us)

View File

@ -98,6 +98,22 @@ struct KeyData
static struct KeyData keys[MAX_KEYS];
/**
* Release memory occupied by #keys.
*/
static void
free_keys (void)
{
for (unsigned int i = 0; i<MAX_KEYS; i++)
if (keys[i].valid)
{
TALER_denom_pub_free (&keys[i].denom_pub);
GNUNET_assert (num_keys > 0);
num_keys--;
}
}
/**
* Function called with information about available keys for signing. Usually
* only called once per key upon connect. Also called again in case a key is
@ -127,6 +143,7 @@ key_cb (void *cls,
const struct TALER_SecurityModulePublicKeyP *sm_pub,
const struct TALER_SecurityModuleSignatureP *sm_sig)
{
(void) cls;
(void) sm_pub;
(void) sm_sig;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@ -472,9 +489,6 @@ par_signing (struct GNUNET_CONFIGURATION_Handle *cfg)
for (unsigned int i = 0; i<NUM_CORES; i++)
{
pids[i] = fork ();
memset (keys,
0,
sizeof (keys));
num_keys = 0;
GNUNET_assert (-1 != pids[i]);
if (0 == pids[i])
@ -488,6 +502,7 @@ par_signing (struct GNUNET_CONFIGURATION_Handle *cfg)
ret = perf_signing (dh,
"parallel");
TALER_CRYPTO_helper_rsa_disconnect (dh);
free_keys ();
exit (ret);
}
}
@ -571,16 +586,10 @@ run_test (void)
ret = perf_signing (dh,
"sequential");
TALER_CRYPTO_helper_rsa_disconnect (dh);
free_keys ();
if (0 == ret)
ret = par_signing (cfg);
/* clean up our state */
for (unsigned int i = 0; i<MAX_KEYS; i++)
if (keys[i].valid)
{
TALER_denom_pub_free (&keys[i].denom_pub);
GNUNET_assert (num_keys > 0);
num_keys--;
}
GNUNET_CONFIGURATION_destroy (cfg);
return ret;
}