diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-01-27 23:06:23 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-01-27 23:06:23 +0100 |
commit | ea3fac606311d1c14362d387960a4913182b629e (patch) | |
tree | c6e85271898e14ebed421b83439ee116f00ef39e /src/mint/taler-mint-httpd_db.c | |
parent | 5647ed2be5cc69d25e393fc3a511bb0959566367 (diff) | |
download | exchange-ea3fac606311d1c14362d387960a4913182b629e.tar.gz exchange-ea3fac606311d1c14362d387960a4913182b629e.tar.bz2 exchange-ea3fac606311d1c14362d387960a4913182b629e.zip |
starting to clean up /deposit logic
Diffstat (limited to 'src/mint/taler-mint-httpd_db.c')
-rw-r--r-- | src/mint/taler-mint-httpd_db.c | 12 |
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, const struct Deposit *deposit) { PGconn *db_conn; - struct Deposit *existing_deposit; + struct Deposit existing_deposit; int res; if (NULL == (db_conn = TALER_MINT_DB_get_connection ())) @@ -63,13 +63,15 @@ TALER_MINT_db_execute_deposit (struct MHD_Connection *connection, return TALER_MINT_reply_internal_db_error (connection); } res = TALER_MINT_DB_get_deposit (db_conn, - &deposit->coin_pub, + &deposit->coin.coin_pub, &existing_deposit); if (GNUNET_YES == res) { // FIXME: memory leak // FIXME: memcmp will not actually work here - if (0 == memcmp (existing_deposit, deposit, sizeof (struct Deposit))) + if (0 == memcmp (&existing_deposit, + deposit, + sizeof (struct Deposit))) return TALER_MINT_reply_deposit_success (connection, deposit); // FIXME: in the future, check if there's enough credits // left on the coin. For now: refuse @@ -93,7 +95,9 @@ TALER_MINT_db_execute_deposit (struct MHD_Connection *connection, int res; struct TALER_CoinPublicInfo coin_info; - res = TALER_MINT_DB_get_known_coin (db_conn, &coin_info.coin_pub, &known_coin); + res = TALER_MINT_DB_get_known_coin (db_conn, + &coin_info.coin_pub, + &known_coin); if (GNUNET_YES == res) { // coin must have been refreshed |