Line data Source code
1 : /*
2 : This file is part of TALER
3 : Copyright (C) 2015, 2016, 2020, 2024 Taler Systems SA
4 :
5 : TALER is free software; you can redistribute it and/or modify it under the
6 : terms of the GNU General Public License as published by the Free Software
7 : Foundation; either version 3, or (at your option) any later version.
8 :
9 : TALER is distributed in the hope that it will be useful, but WITHOUT ANY
10 : WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 : A PARTICULAR PURPOSE. See the GNU General Public License for more details.
12 :
13 : You should have received a copy of the GNU General Public License along with
14 : TALER; see the file COPYING. If not, see <http://www.gnu.org/licenses/>
15 : */
16 : /**
17 : * @file exchangedb/free_reserve_history.c
18 : * @brief Function to free a reserve history
19 : * @author Christian Grothoff
20 : */
21 : #include "taler/platform.h"
22 : #include "exchange-database/free_reserve_history.h"
23 :
24 :
25 : void
26 8 : TALER_EXCHANGEDB_free_reserve_history (
27 : struct TALER_EXCHANGEDB_ReserveHistory *rh)
28 : {
29 31 : while (NULL != rh)
30 : {
31 23 : switch (rh->type)
32 : {
33 8 : case TALER_EXCHANGEDB_RO_BANK_TO_EXCHANGE:
34 : {
35 : struct TALER_EXCHANGEDB_BankTransfer *bt;
36 :
37 8 : bt = rh->details.bank;
38 8 : GNUNET_free (bt->sender_account_details.full_payto);
39 8 : GNUNET_free (bt);
40 8 : break;
41 : }
42 7 : case TALER_EXCHANGEDB_RO_WITHDRAW_COINS:
43 : {
44 : struct TALER_EXCHANGEDB_Withdraw *wd;
45 7 : wd = rh->details.withdraw;
46 7 : GNUNET_free (wd->denom_pub_hashes);
47 7 : GNUNET_free (wd);
48 7 : break;
49 : }
50 0 : case TALER_EXCHANGEDB_RO_RECOUP_COIN:
51 : {
52 : struct TALER_EXCHANGEDB_Recoup *recoup;
53 :
54 0 : recoup = rh->details.recoup;
55 0 : TALER_denom_sig_free (&recoup->coin.denom_sig);
56 0 : GNUNET_free (recoup);
57 0 : break;
58 : }
59 0 : case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK:
60 : {
61 : struct TALER_EXCHANGEDB_ClosingTransfer *closing;
62 :
63 0 : closing = rh->details.closing;
64 0 : GNUNET_free (closing->receiver_account_details.full_payto);
65 0 : GNUNET_free (closing);
66 0 : break;
67 : }
68 8 : case TALER_EXCHANGEDB_RO_PURSE_MERGE:
69 : {
70 : struct TALER_EXCHANGEDB_PurseMerge *merge;
71 :
72 8 : merge = rh->details.merge;
73 8 : GNUNET_free (merge);
74 8 : break;
75 : }
76 0 : case TALER_EXCHANGEDB_RO_HISTORY_REQUEST:
77 : {
78 : struct TALER_EXCHANGEDB_HistoryRequest *history;
79 :
80 0 : history = rh->details.history;
81 0 : GNUNET_free (history);
82 0 : break;
83 : }
84 0 : case TALER_EXCHANGEDB_RO_OPEN_REQUEST:
85 : {
86 : struct TALER_EXCHANGEDB_OpenRequest *or;
87 :
88 0 : or = rh->details.open_request;
89 0 : GNUNET_free (or);
90 0 : break;
91 : }
92 0 : case TALER_EXCHANGEDB_RO_CLOSE_REQUEST:
93 : {
94 : struct TALER_EXCHANGEDB_CloseRequest *cr;
95 :
96 0 : cr = rh->details.close_request;
97 0 : GNUNET_free (cr);
98 0 : break;
99 : }
100 : }
101 : {
102 : struct TALER_EXCHANGEDB_ReserveHistory *next;
103 :
104 23 : next = rh->next;
105 23 : GNUNET_free (rh);
106 23 : rh = next;
107 : }
108 : }
109 8 : }
110 :
111 :
112 : /* end of free_reserve_history.c */
|