fix potential free of uninitialized ptr, (on virtually impossible error handling path)

This commit is contained in:
Christian Grothoff 2019-06-03 11:17:29 +02:00
parent 256910e28d
commit 91ef87a804
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC

View File

@ -246,7 +246,7 @@ free_melt_data (struct MeltData *md)
}
for (unsigned int i=0;i<TALER_CNC_KAPPA;i++)
GNUNET_free (md->fresh_coins[i]);
GNUNET_free_non_null (md->fresh_coins[i]);
/* Finally, clean up a bit...
(NOTE: compilers might optimize this away, so this is
not providing any strong assurances that the key material
@ -705,6 +705,7 @@ TALER_EXCHANGE_refresh_prepare (const struct TALER_CoinSpendPrivateKeyP *melt_pr
GNUNET_CRYPTO_eddsa_key_get_public (&melt_priv->eddsa_priv,
&coin_pub.eddsa_pub);
/* build up melt data structure */
memset (&md, 0, sizeof (md));
md.num_fresh_coins = fresh_pks_len;
md.melted_coin.coin_priv = *melt_priv;
md.melted_coin.melt_amount_with_fee = *melt_amount;