check more return values

This commit is contained in:
Christian Grothoff 2019-06-03 10:44:57 +02:00
parent 2cea0eb4d2
commit c241694ccb
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
6 changed files with 183 additions and 109 deletions

View File

@ -227,8 +227,9 @@ TFH_build_history_response (struct MHD_Connection *connection,
while (NULL != history_element)
{
GNUNET_assert (0 ==
json_array_append_new (history,
history_element->element);
history_element->element));
history_element = history_element->next;
if (NULL != history_element)
GNUNET_free_non_null (history_element->prev);

View File

@ -376,12 +376,14 @@ run (void *cls,
GNUNET_asprintf (&withdraw_fee_str,
"%s:0.1",
currency);
GNUNET_assert (GNUNET_OK ==
TALER_string_to_amount (withdraw_fee_str,
&withdraw_fee);
&withdraw_fee));
for (unsigned int i = 0; i < howmany_coins; i++)
GNUNET_assert (GNUNET_OK ==
TALER_amount_add (&total_reserve_amount,
&total_reserve_amount,
&withdraw_fee);
&withdraw_fee));
for (unsigned int j = 0; j < howmany_reserves; j++)
{
char *create_reserve_label;

View File

@ -704,8 +704,15 @@ deposit_cb (void *cls,
GNUNET_break (0);
return GNUNET_DB_STATUS_HARD_ERROR;
}
if (GNUNET_OK !=
TALER_JSON_merchant_wire_signature_hash (wire,
&au->h_wire);
&au->h_wire))
{
GNUNET_break (0);
json_decref (au->wire);
au->wire = NULL;
return GNUNET_DB_STATUS_HARD_ERROR;
}
GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_NONCE,
&au->wtid,
sizeof (au->wtid));

View File

@ -366,9 +366,10 @@ refresh_reveal_transaction (void *cls,
TALER_planchet_setup_refresh (&ts,
j,
&ps);
GNUNET_assert (GNUNET_OK ==
TALER_planchet_prepare (rcd->dk,
&ps,
&pd);
&pd));
rcd->coin_ev = pd.coin_ev;
rcd->coin_ev_size = pd.coin_ev_size;
}

View File

@ -226,11 +226,12 @@ TEH_TEST_handler_test_hkdf (struct TEH_RequestHandler *rh,
json_decref (json);
if (GNUNET_YES != res)
return (GNUNET_NO == res) ? MHD_YES : MHD_NO;
GNUNET_assert (GNUNET_YES ==
GNUNET_CRYPTO_kdf (&hc, sizeof (hc),
"salty", strlen ("salty"),
in_ptr,
in_ptr_size,
NULL, 0);
NULL, 0));
GNUNET_JSON_parse_free (spec);
json = GNUNET_JSON_from_data_auto (&hc);
return TEH_RESPONSE_reply_json_pack (connection,

View File

@ -1593,6 +1593,11 @@ TALER_EXCHANGE_serialize_data
now = GNUNET_TIME_absolute_get ();
signkeys = json_array ();
if (NULL == signkeys)
{
GNUNET_break (0);
return NULL;
}
for (unsigned int i=0;i<kd->num_sign_keys;i++)
{
const struct TALER_EXCHANGE_SigningPublicKey *sk = &kd->sign_keys[i];
@ -1621,10 +1626,22 @@ TALER_EXCHANGE_serialize_data
GNUNET_break (0);
continue;
}
json_array_append_new (signkeys,
signkey);
if (0 != json_array_append_new (signkeys,
signkey))
{
GNUNET_break (0);
json_decref (signkey);
json_decref (signkeys);
return NULL;
}
}
denoms = json_array ();
if (NULL == denoms)
{
GNUNET_break (0);
json_decref (signkeys);
return NULL;
}
for (unsigned int i=0;i<kd->num_denom_keys;i++)
{
const struct TALER_EXCHANGE_DenomPublicKey *dk = &kd->denom_keys[i];
@ -1664,10 +1681,24 @@ TALER_EXCHANGE_serialize_data
GNUNET_break (0);
continue;
}
json_array_append_new (denoms,
denom);
if (0 == json_array_append_new (denoms,
denom))
{
GNUNET_break (0);
json_decref (denom);
json_decref (denoms);
json_decref (signkeys);
return NULL;
}
}
auditors = json_array ();
if (NULL == auditors)
{
GNUNET_break (0);
json_decref (denoms);
json_decref (signkeys);
return NULL;
}
for (unsigned int i=0;i<kd->num_auditors;i++)
{
const struct TALER_EXCHANGE_AuditorInformation *ai = &kd->auditors[i];
@ -1675,6 +1706,14 @@ TALER_EXCHANGE_serialize_data
json_t *adenoms;
adenoms = json_array ();
if (NULL == adenoms)
{
GNUNET_break (0);
json_decref (denoms);
json_decref (signkeys);
json_decref (auditors);
return NULL;
}
for (unsigned int j=0;j<ai->num_denom_keys;j++)
{
const struct TALER_EXCHANGE_AuditorDenominationInfo *adi = &ai->denom_keys[j];
@ -1692,10 +1731,23 @@ TALER_EXCHANGE_serialize_data
if (NULL == k)
{
GNUNET_break (0);
continue;
json_decref (adenoms);
json_decref (denoms);
json_decref (signkeys);
json_decref (auditors);
return NULL;
}
if (0 != json_array_append_new (adenoms,
k))
{
GNUNET_break (0);
json_decref (k);
json_decref (adenoms);
json_decref (denoms);
json_decref (signkeys);
json_decref (auditors);
return NULL;
}
json_array_append_new (adenoms,
k);
}
a = json_pack ("{s:o, s:s, s:o}",
@ -1707,11 +1759,21 @@ TALER_EXCHANGE_serialize_data
adenoms);
if (NULL == a)
{
GNUNET_break (0);
continue;
json_decref (adenoms);
json_decref (denoms);
json_decref (signkeys);
json_decref (auditors);
return NULL;
}
if (0 != json_array_append_new (auditors,
a))
{
json_decref (a);
json_decref (denoms);
json_decref (signkeys);
json_decref (auditors);
return NULL;
}
json_array_append_new (auditors,
a);
}
keys = json_pack ("{s:s, s:o, s:o, s:o, s:o"
",s:o, s:o}",