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 "platform.h"
22 : #include "exchange-database/free_reserve_history.h"
23 :
24 :
25 : void
26 18 : TALER_EXCHANGEDB_free_reserve_history (
27 : struct TALER_EXCHANGEDB_ReserveHistory *rh)
28 : {
29 61 : while (NULL != rh)
30 : {
31 43 : switch (rh->type)
32 : {
33 16 : case TALER_EXCHANGEDB_RO_BANK_TO_EXCHANGE:
34 : {
35 : struct TALER_EXCHANGEDB_BankTransfer *bt;
36 :
37 16 : bt = rh->details.bank;
38 16 : GNUNET_free (bt->sender_account_details.full_payto);
39 16 : GNUNET_free (bt);
40 16 : break;
41 : }
42 11 : case TALER_EXCHANGEDB_RO_WITHDRAW_COINS:
43 : {
44 : struct TALER_EXCHANGEDB_Withdraw *wd;
45 11 : wd = rh->details.withdraw;
46 11 : GNUNET_free (wd->denom_pub_hashes);
47 11 : GNUNET_free (wd->denom_serials);
48 11 : GNUNET_free (wd);
49 11 : break;
50 : }
51 5 : case TALER_EXCHANGEDB_RO_RECOUP_COIN:
52 : {
53 : struct TALER_EXCHANGEDB_Recoup *recoup;
54 :
55 5 : recoup = rh->details.recoup;
56 5 : TALER_denom_sig_free (&recoup->coin.denom_sig);
57 5 : GNUNET_free (recoup);
58 5 : break;
59 : }
60 0 : case TALER_EXCHANGEDB_RO_EXCHANGE_TO_BANK:
61 : {
62 : struct TALER_EXCHANGEDB_ClosingTransfer *closing;
63 :
64 0 : closing = rh->details.closing;
65 0 : GNUNET_free (closing->receiver_account_details.full_payto);
66 0 : GNUNET_free (closing);
67 0 : break;
68 : }
69 8 : case TALER_EXCHANGEDB_RO_PURSE_MERGE:
70 : {
71 : struct TALER_EXCHANGEDB_PurseMerge *merge;
72 :
73 8 : merge = rh->details.merge;
74 8 : GNUNET_free (merge);
75 8 : break;
76 : }
77 0 : case TALER_EXCHANGEDB_RO_HISTORY_REQUEST:
78 : {
79 : struct TALER_EXCHANGEDB_HistoryRequest *history;
80 :
81 0 : history = rh->details.history;
82 0 : GNUNET_free (history);
83 0 : break;
84 : }
85 0 : case TALER_EXCHANGEDB_RO_OPEN_REQUEST:
86 : {
87 : struct TALER_EXCHANGEDB_OpenRequest *or;
88 :
89 0 : or = rh->details.open_request;
90 0 : GNUNET_free (or);
91 0 : break;
92 : }
93 3 : case TALER_EXCHANGEDB_RO_CLOSE_REQUEST:
94 : {
95 : struct TALER_EXCHANGEDB_CloseRequest *cr;
96 :
97 3 : cr = rh->details.close_request;
98 3 : GNUNET_free (cr);
99 3 : break;
100 : }
101 : }
102 : {
103 : struct TALER_EXCHANGEDB_ReserveHistory *next;
104 :
105 43 : next = rh->next;
106 43 : GNUNET_free (rh);
107 43 : rh = next;
108 : }
109 : }
110 18 : }
111 :
112 :
113 : /* end of free_reserve_history.c */
|