commit f26f41fc51af2676107f0ac98d888b8b5f5d7de8
parent 93e69c3d78342eb24f20cdfa83553e709a210f20
Author: Christian Grothoff <grothoff@gnunet.org>
Date: Sat, 23 Aug 2025 22:45:03 +0200
avoid using uninit value
Diffstat:
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/src/backenddb/pg_lookup_statistics_amount_by_interval.c b/src/backenddb/pg_lookup_statistics_amount_by_interval.c
@@ -110,7 +110,7 @@ lookup_statistics_amount_by_interval_cb (void *cls,
struct LookupAmountStatisticsContext *tflc = cls;
struct TALER_Amount *amounts = NULL;
char *resp_desc = NULL;
- uint64_t cur_interval_start_ago;
+ uint64_t cur_interval_start_ago = UINT64_MAX;
unsigned int amounts_len = 0;
for (unsigned int i = 0; i < num_results; i++)
@@ -136,7 +136,8 @@ lookup_statistics_amount_by_interval_cb (void *cls,
}
/* Call callback if the bucket changed */
- if (interval_start_ago != cur_interval_start_ago)
+ if ( (interval_start_ago != cur_interval_start_ago) &&
+ (i > 0) )
{
struct GNUNET_TIME_Timestamp interval_start;
diff --git a/src/lib/merchant_api_get_statistics.c b/src/lib/merchant_api_get_statistics.c
@@ -169,16 +169,11 @@ parse_intervals_and_buckets_amt (
if (GNUNET_SYSERR == ret)
break;
amounts_len = json_array_size (amounts_arr);
- if (0 > amounts_len)
- {
- GNUNET_break_op (0);
- ret = GNUNET_SYSERR;
- break;
- }
{
struct TALER_Amount amt_arr[amounts_len];
size_t aindex;
json_t *avalue;
+
jinterval->cumulative_amount_len = amounts_len;
jinterval->cumulative_amounts = amt_arr;
json_array_foreach (amounts_arr, aindex, avalue) {