aboutsummaryrefslogtreecommitdiff
path: root/src/mint/taler-mint-httpd_db.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mint/taler-mint-httpd_db.c')
-rw-r--r--src/mint/taler-mint-httpd_db.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mint/taler-mint-httpd_db.c b/src/mint/taler-mint-httpd_db.c
index baf5d12aa..fcc6d915f 100644
--- a/src/mint/taler-mint-httpd_db.c
+++ b/src/mint/taler-mint-httpd_db.c
@@ -54,7 +54,7 @@ TALER_MINT_db_execute_deposit (struct MHD_Connection *connection,
54 const struct Deposit *deposit) 54 const struct Deposit *deposit)
55{ 55{
56 PGconn *db_conn; 56 PGconn *db_conn;
57 struct Deposit *existing_deposit; 57 struct Deposit existing_deposit;
58 int res; 58 int res;
59 59
60 if (NULL == (db_conn = TALER_MINT_DB_get_connection ())) 60 if (NULL == (db_conn = TALER_MINT_DB_get_connection ()))
@@ -63,13 +63,15 @@ TALER_MINT_db_execute_deposit (struct MHD_Connection *connection,
63 return TALER_MINT_reply_internal_db_error (connection); 63 return TALER_MINT_reply_internal_db_error (connection);
64 } 64 }
65 res = TALER_MINT_DB_get_deposit (db_conn, 65 res = TALER_MINT_DB_get_deposit (db_conn,
66 &deposit->coin_pub, 66 &deposit->coin.coin_pub,
67 &existing_deposit); 67 &existing_deposit);
68 if (GNUNET_YES == res) 68 if (GNUNET_YES == res)
69 { 69 {
70 // FIXME: memory leak 70 // FIXME: memory leak
71 // FIXME: memcmp will not actually work here 71 // FIXME: memcmp will not actually work here
72 if (0 == memcmp (existing_deposit, deposit, sizeof (struct Deposit))) 72 if (0 == memcmp (&existing_deposit,
73 deposit,
74 sizeof (struct Deposit)))
73 return TALER_MINT_reply_deposit_success (connection, deposit); 75 return TALER_MINT_reply_deposit_success (connection, deposit);
74 // FIXME: in the future, check if there's enough credits 76 // FIXME: in the future, check if there's enough credits
75 // left on the coin. For now: refuse 77 // left on the coin. For now: refuse
@@ -93,7 +95,9 @@ TALER_MINT_db_execute_deposit (struct MHD_Connection *connection,
93 int res; 95 int res;
94 struct TALER_CoinPublicInfo coin_info; 96 struct TALER_CoinPublicInfo coin_info;
95 97
96 res = TALER_MINT_DB_get_known_coin (db_conn, &coin_info.coin_pub, &known_coin); 98 res = TALER_MINT_DB_get_known_coin (db_conn,
99 &coin_info.coin_pub,
100 &known_coin);
97 if (GNUNET_YES == res) 101 if (GNUNET_YES == res)
98 { 102 {
99 // coin must have been refreshed 103 // coin must have been refreshed