fixing (make copy, as original may disappear)

This commit is contained in:
Christian Grothoff 2019-06-06 20:52:32 +02:00
parent 69a07468de
commit a4813d1864
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
4 changed files with 38 additions and 30 deletions

View File

@ -1165,6 +1165,7 @@ TALER_EXCHANGE_check_keys_current (struct TALER_EXCHANGE_Handle *exchange,
return GNUNET_TIME_UNIT_ZERO_ABS; return GNUNET_TIME_UNIT_ZERO_ABS;
} }
/** /**
* Callback used when downloading the reply to a /keys request * Callback used when downloading the reply to a /keys request
* is complete. * is complete.

View File

@ -57,7 +57,7 @@ struct TALER_EXCHANGE_PaybackHandle
/** /**
* Denomination key of the coin. * Denomination key of the coin.
*/ */
const struct TALER_EXCHANGE_DenomPublicKey *pk; struct TALER_EXCHANGE_DenomPublicKey pk;
/** /**
* Handle for the request. * Handle for the request.
@ -195,7 +195,7 @@ handle_payback_finished (void *cls,
struct TALER_Amount total; struct TALER_Amount total;
const struct TALER_EXCHANGE_DenomPublicKey *dki; const struct TALER_EXCHANGE_DenomPublicKey *dki;
dki = ph->pk; dki = &ph->pk;
history = json_object_get (j, history = json_object_get (j,
"history"); "history");
if (GNUNET_OK != if (GNUNET_OK !=
@ -318,7 +318,8 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange,
ph = GNUNET_new (struct TALER_EXCHANGE_PaybackHandle); ph = GNUNET_new (struct TALER_EXCHANGE_PaybackHandle);
ph->coin_pub = pr.coin_pub; ph->coin_pub = pr.coin_pub;
ph->exchange = exchange; ph->exchange = exchange;
ph->pk = pk; ph->pk = *pk;
ph->pk.key.rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (pk->key.rsa_public_key);
ph->cb = payback_cb; ph->cb = payback_cb;
ph->cb_cls = payback_cb_cls; ph->cb_cls = payback_cb_cls;
ph->url = TEAH_path_to_url (exchange, "/payback"); ph->url = TEAH_path_to_url (exchange, "/payback");
@ -332,6 +333,7 @@ TALER_EXCHANGE_payback (struct TALER_EXCHANGE_Handle *exchange,
curl_easy_cleanup (eh); curl_easy_cleanup (eh);
json_decref (payback_obj); json_decref (payback_obj);
GNUNET_free (ph->url); GNUNET_free (ph->url);
GNUNET_CRYPTO_rsa_public_key_free (ph->pk.key.rsa_public_key);
GNUNET_free (ph); GNUNET_free (ph);
return NULL; return NULL;
} }
@ -365,6 +367,7 @@ TALER_EXCHANGE_payback_cancel (struct TALER_EXCHANGE_PaybackHandle *ph)
} }
GNUNET_free (ph->url); GNUNET_free (ph->url);
TALER_curl_easy_post_finished (&ph->ctx); TALER_curl_easy_post_finished (&ph->ctx);
GNUNET_CRYPTO_rsa_public_key_free (ph->pk.key.rsa_public_key);
GNUNET_free (ph); GNUNET_free (ph);
} }

View File

@ -700,7 +700,7 @@ struct TALER_EXCHANGE_ReserveWithdrawHandle
/** /**
* Denomination key we are withdrawing. * Denomination key we are withdrawing.
*/ */
const struct TALER_EXCHANGE_DenomPublicKey *pk; struct TALER_EXCHANGE_DenomPublicKey pk;
/** /**
* Closure for @a cb. * Closure for @a cb.
@ -755,7 +755,7 @@ reserve_withdraw_ok (struct TALER_EXCHANGE_ReserveWithdrawHandle *wsh,
return GNUNET_SYSERR; return GNUNET_SYSERR;
} }
if (GNUNET_OK != if (GNUNET_OK !=
TALER_planchet_to_coin (&wsh->pk->key, TALER_planchet_to_coin (&wsh->pk.key,
blind_sig, blind_sig,
&wsh->ps, &wsh->ps,
&wsh->c_hash, &wsh->c_hash,
@ -868,8 +868,8 @@ reserve_withdraw_payment_required (struct TALER_EXCHANGE_ReserveWithdrawHandle *
/* Compute how much we expected to charge to the reserve */ /* Compute how much we expected to charge to the reserve */
if (GNUNET_OK != if (GNUNET_OK !=
TALER_amount_add (&requested_amount, TALER_amount_add (&requested_amount,
&wsh->pk->value, &wsh->pk.value,
&wsh->pk->fee_withdraw)) &wsh->pk.fee_withdraw))
{ {
/* Overflow here? Very strange, our CPU must be fried... */ /* Overflow here? Very strange, our CPU must be fried... */
GNUNET_break (0); GNUNET_break (0);
@ -1008,7 +1008,8 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange,
wsh->exchange = exchange; wsh->exchange = exchange;
wsh->cb = res_cb; wsh->cb = res_cb;
wsh->cb_cls = res_cb_cls; wsh->cb_cls = res_cb_cls;
wsh->pk = pk; wsh->pk = *pk;
wsh->pk.key.rsa_public_key = GNUNET_CRYPTO_rsa_public_key_dup (pk->key.rsa_public_key);
wsh->reserve_pub = *reserve_pub; wsh->reserve_pub = *reserve_pub;
wsh->c_hash = pd->c_hash; wsh->c_hash = pd->c_hash;
GNUNET_CRYPTO_rsa_public_key_hash (pk->key.rsa_public_key, GNUNET_CRYPTO_rsa_public_key_hash (pk->key.rsa_public_key,
@ -1023,6 +1024,7 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange,
if (NULL == withdraw_obj) if (NULL == withdraw_obj)
{ {
GNUNET_break (0); GNUNET_break (0);
GNUNET_CRYPTO_rsa_public_key_free (wsh->pk.key.rsa_public_key);
GNUNET_free (wsh); GNUNET_free (wsh);
return NULL; return NULL;
} }
@ -1039,6 +1041,7 @@ reserve_withdraw_internal (struct TALER_EXCHANGE_Handle *exchange,
curl_easy_cleanup (eh); curl_easy_cleanup (eh);
json_decref (withdraw_obj); json_decref (withdraw_obj);
GNUNET_free (wsh->url); GNUNET_free (wsh->url);
GNUNET_CRYPTO_rsa_public_key_free (wsh->pk.key.rsa_public_key);
GNUNET_free (wsh); GNUNET_free (wsh);
return NULL; return NULL;
} }
@ -1202,6 +1205,7 @@ TALER_EXCHANGE_reserve_withdraw_cancel (struct TALER_EXCHANGE_ReserveWithdrawHan
} }
GNUNET_free (sign->url); GNUNET_free (sign->url);
TALER_curl_easy_post_finished (&sign->ctx); TALER_curl_easy_post_finished (&sign->ctx);
GNUNET_CRYPTO_rsa_public_key_free (sign->pk.key.rsa_public_key);
GNUNET_free (sign); GNUNET_free (sign);
} }