summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-06-11 16:16:49 +0200
committerChristian Grothoff <christian@grothoff.org>2016-06-11 16:16:49 +0200
commitce5587b42770f6eb91ec2ca31342e267ae074605 (patch)
treebbaf0acdf78abee95b0c0581a0b0ee67c558c10f /src
parent7dc075ae283f76669065c7357d6c8e4d39ae811e (diff)
downloadexchange-ce5587b42770f6eb91ec2ca31342e267ae074605.tar.gz
exchange-ce5587b42770f6eb91ec2ca31342e267ae074605.tar.bz2
exchange-ce5587b42770f6eb91ec2ca31342e267ae074605.zip
fix memory leaks: json_array_append increments RC
Diffstat (limited to 'src')
-rw-r--r--src/exchange-lib/exchange_api_refresh.c36
-rw-r--r--src/exchange/taler-exchange-httpd_responses.c14
2 files changed, 25 insertions, 25 deletions
diff --git a/src/exchange-lib/exchange_api_refresh.c b/src/exchange-lib/exchange_api_refresh.c
index e2e06a113..98c6c086b 100644
--- a/src/exchange-lib/exchange_api_refresh.c
+++ b/src/exchange-lib/exchange_api_refresh.c
@@ -1318,8 +1318,8 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange,
GNUNET_CRYPTO_ecdhe_key_get_public (&mc->transfer_priv[j].ecdhe_priv,
&transfer_pub.ecdhe_pub);
GNUNET_assert (0 ==
- json_array_append (transfer_pubs,
- GNUNET_JSON_from_data_auto (&transfer_pub)));
+ json_array_append_new (transfer_pubs,
+ GNUNET_JSON_from_data_auto (&transfer_pub)));
}
/* now secret_encs */
@@ -1337,17 +1337,17 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange,
&trans_sec,
&els));
GNUNET_assert (0 ==
- json_array_append (secret_encs,
- GNUNET_JSON_from_data_auto (&els)));
+ json_array_append_new (secret_encs,
+ GNUNET_JSON_from_data_auto (&els)));
}
/* now new_denoms */
for (i=0;i<md->num_fresh_coins;i++)
{
GNUNET_assert (0 ==
- json_array_append (new_denoms,
- GNUNET_JSON_from_rsa_public_key
- (md->fresh_pks[i].rsa_public_key)));
+ json_array_append_new (new_denoms,
+ GNUNET_JSON_from_rsa_public_key
+ (md->fresh_pks[i].rsa_public_key)));
}
/* now link_encs */
@@ -1366,12 +1366,12 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange,
&md->link_secrets[j],
&rle);
GNUNET_assert (0 ==
- json_array_append (tmp,
- GNUNET_JSON_from_data_auto (&rle)));
+ json_array_append_new (tmp,
+ GNUNET_JSON_from_data_auto (&rle)));
}
GNUNET_assert (0 ==
- json_array_append (link_encs,
- tmp));
+ json_array_append_new (link_encs,
+ tmp));
}
/* now coin_evs */
@@ -1410,14 +1410,14 @@ TALER_EXCHANGE_refresh_melt (struct TALER_EXCHANGE_Handle *exchange,
return NULL;
}
GNUNET_assert (0 ==
- json_array_append (tmp,
- GNUNET_JSON_from_data (coin_ev,
- coin_ev_size)));
+ json_array_append_new (tmp,
+ GNUNET_JSON_from_data (coin_ev,
+ coin_ev_size)));
GNUNET_free (coin_ev);
}
GNUNET_assert (0 ==
- json_array_append (coin_evs,
- tmp));
+ json_array_append_new (coin_evs,
+ tmp));
}
/* finally, assemble main JSON request from constitutent arrays */
@@ -1796,8 +1796,8 @@ TALER_EXCHANGE_refresh_reveal (struct TALER_EXCHANGE_Handle *exchange,
continue;
}
GNUNET_assert (0 ==
- json_array_append (transfer_privs,
- GNUNET_JSON_from_data_auto (&md->melted_coin.transfer_priv[j])));
+ json_array_append_new (transfer_privs,
+ GNUNET_JSON_from_data_auto (&md->melted_coin.transfer_priv[j])));
}
/* build main JSON request */
diff --git a/src/exchange/taler-exchange-httpd_responses.c b/src/exchange/taler-exchange-httpd_responses.c
index 1b3418dfb..0c296d942 100644
--- a/src/exchange/taler-exchange-httpd_responses.c
+++ b/src/exchange/taler-exchange-httpd_responses.c
@@ -1278,13 +1278,13 @@ TMH_RESPONSE_reply_track_transfer_details (struct MHD_Connection *connection,
&dd,
sizeof (struct TALER_WireDepositDetailP));
GNUNET_assert (0 ==
- json_array_append (deposits,
- json_pack ("{s:o, s:I, s:o, s:o, s:o}",
- "H_contract", GNUNET_JSON_from_data_auto (&wdd_pos->h_contract),
- "transaction_id", (json_int_t) wdd_pos->transaction_id,
- "coin_pub", GNUNET_JSON_from_data_auto (&wdd_pos->coin_pub),
- "deposit_value", TALER_JSON_from_amount (&wdd_pos->deposit_value),
- "deposit_fee", TALER_JSON_from_amount (&wdd_pos->deposit_fee))));
+ json_array_append_new (deposits,
+ json_pack ("{s:o, s:I, s:o, s:o, s:o}",
+ "H_contract", GNUNET_JSON_from_data_auto (&wdd_pos->h_contract),
+ "transaction_id", (json_int_t) wdd_pos->transaction_id,
+ "coin_pub", GNUNET_JSON_from_data_auto (&wdd_pos->coin_pub),
+ "deposit_value", TALER_JSON_from_amount (&wdd_pos->deposit_value),
+ "deposit_fee", TALER_JSON_from_amount (&wdd_pos->deposit_fee))));
}
wdp.purpose.purpose = htonl (TALER_SIGNATURE_EXCHANGE_CONFIRM_WIRE_DEPOSIT);
wdp.purpose.size = htonl (sizeof (struct TALER_WireDepositDataPS));