commit 86551a20488a4d83fd326be7a8974f23ac9bd3f0
parent 4e2d5fb354ad8605413931ee8d6137cbacfd3732
Author: Christian Grothoff <christian@grothoff.org>
Date: Fri, 9 May 2025 18:14:11 +0200
-fix another minor leak
Diffstat:
1 file changed, 55 insertions(+), 27 deletions(-)
diff --git a/src/auditor/taler-helper-auditor-coins.c b/src/auditor/taler-helper-auditor-coins.c
@@ -2787,7 +2787,7 @@ analyze_coins (void *cls)
if (0 > qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return qs;
+ goto cleanup;
}
/* process withdrawals */
if (0 >
@@ -2798,10 +2798,13 @@ analyze_coins (void *cls)
&cc)))
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return qs;
+ goto cleanup;
}
if (0 > cc.qs)
- return cc.qs;
+ {
+ qs = cc.qs;
+ goto cleanup;
+ }
/* process recoups */
if (0 >
(qs = TALER_ARL_edb->select_recoup_refresh_above_serial_id (
@@ -2811,10 +2814,13 @@ analyze_coins (void *cls)
&cc)))
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return qs;
+ goto cleanup;
}
if (0 > cc.qs)
- return cc.qs;
+ {
+ qs = cc.qs;
+ goto cleanup;
+ }
/* process deposits */
if (0 >
(qs = TALER_ARL_edb->select_coin_deposits_above_serial_id (
@@ -2824,10 +2830,13 @@ analyze_coins (void *cls)
&cc)))
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return qs;
+ goto cleanup;
}
if (0 > cc.qs)
- return cc.qs;
+ {
+ qs = cc.qs;
+ goto cleanup;
+ }
/* process purse_deposits */
if (0 >
(qs = TALER_ARL_edb->select_purse_deposits_above_serial_id (
@@ -2837,10 +2846,13 @@ analyze_coins (void *cls)
&cc)))
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return qs;
+ goto cleanup;
}
if (0 > cc.qs)
- return cc.qs;
+ {
+ qs = cc.qs;
+ goto cleanup;
+ }
/* process refunds */
if (0 >
(qs = TALER_ARL_edb->select_refunds_above_serial_id (
@@ -2850,10 +2862,13 @@ analyze_coins (void *cls)
&cc)))
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return qs;
+ goto cleanup;
}
if (0 > cc.qs)
- return cc.qs;
+ {
+ qs = cc.qs;
+ goto cleanup;
+ }
/* process purse_refunds */
if (0 >
(qs = TALER_ARL_edb->select_purse_decisions_above_serial_id (
@@ -2864,10 +2879,13 @@ analyze_coins (void *cls)
&cc)))
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return qs;
+ goto cleanup;
}
if (0 > cc.qs)
- return cc.qs;
+ {
+ qs = cc.qs;
+ goto cleanup;
+ }
/* process refreshes */
if (0 >
(qs = TALER_ARL_edb->select_refreshes_above_serial_id (
@@ -2877,10 +2895,13 @@ analyze_coins (void *cls)
&cc)))
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return qs;
+ goto cleanup;
}
if (0 > cc.qs)
- return cc.qs;
+ {
+ qs = cc.qs;
+ goto cleanup;
+ }
if (0 >
(qs = TALER_ARL_edb->select_recoup_above_serial_id (
TALER_ARL_edb->cls,
@@ -2889,23 +2910,24 @@ analyze_coins (void *cls)
&cc)))
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return qs;
+ goto cleanup;
}
if (0 > cc.qs)
- return cc.qs;
+ {
+ qs = cc.qs;
+ goto cleanup;
+ }
/* sync 'cc' back to disk */
cc.qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
GNUNET_CONTAINER_multihashmap_iterate (cc.denom_summaries,
&sync_denomination,
&cc);
- GNUNET_CONTAINER_multihashmap_iterate (cc.denom_summaries,
- &cleanup_denomination,
- &cc);
- GNUNET_CONTAINER_multihashmap_destroy (cc.denom_summaries);
+
if (0 > cc.qs)
{
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == cc.qs);
- return cc.qs;
+ qs = cc.qs;
+ goto cleanup;
}
qs = TALER_ARL_adb->insert_balance (
@@ -2931,7 +2953,7 @@ analyze_coins (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Failed to update auditor DB, not recording progress\n");
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return qs;
+ goto cleanup;
}
qs = TALER_ARL_adb->update_balance (
@@ -2957,7 +2979,7 @@ analyze_coins (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Failed to update auditor DB, not recording progress\n");
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return qs;
+ goto cleanup;
}
qs = TALER_ARL_adb->insert_auditor_progress (
@@ -2976,7 +2998,7 @@ analyze_coins (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Failed to update auditor DB, not recording progress\n");
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return qs;
+ goto cleanup;
}
qs = TALER_ARL_adb->update_auditor_progress (
@@ -2995,7 +3017,7 @@ analyze_coins (void *cls)
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Failed to update auditor DB, not recording progress\n");
GNUNET_break (GNUNET_DB_STATUS_SOFT_ERROR == qs);
- return qs;
+ goto cleanup;
}
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
@@ -3010,7 +3032,13 @@ analyze_coins (void *cls)
coins_purse_deposits_serial_id),
(unsigned long long) TALER_ARL_USE_PP (
coins_purse_refunds_serial_id));
- return GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
+ qs = GNUNET_DB_STATUS_SUCCESS_ONE_RESULT;
+cleanup:
+ GNUNET_CONTAINER_multihashmap_iterate (cc.denom_summaries,
+ &cleanup_denomination,
+ &cc);
+ GNUNET_CONTAINER_multihashmap_destroy (cc.denom_summaries);
+ return qs;
}