summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-02-13 16:24:38 +0100
committerChristian Grothoff <christian@grothoff.org>2021-02-13 16:24:38 +0100
commit12deb6c2670f663a3c0734e28673f508fffa3210 (patch)
tree0ca246a3b65bf20c541859882edb74225db4a3df /src
parentcd17d095e8d542d6cef854e8394472364e9a01b9 (diff)
downloadexchange-12deb6c2670f663a3c0734e28673f508fffa3210.tar.gz
exchange-12deb6c2670f663a3c0734e28673f508fffa3210.tar.bz2
exchange-12deb6c2670f663a3c0734e28673f508fffa3210.zip
fix memory leaks
Diffstat (limited to 'src')
-rw-r--r--src/exchange/taler-exchange-httpd.c9
-rw-r--r--src/exchange/taler-exchange-httpd_keys.c19
-rw-r--r--src/exchange/taler-exchange-httpd_management_post_keys.c2
-rw-r--r--src/exchange/taler-exchange-httpd_wire.c14
-rw-r--r--src/exchangedb/exchangedb_accounts.c1
-rw-r--r--src/util/crypto_helper_denom.c1
-rw-r--r--src/util/crypto_helper_esign.c1
-rw-r--r--src/util/taler-exchange-secmod-eddsa.c1
-rw-r--r--src/util/taler-exchange-secmod-rsa.c3
9 files changed, 31 insertions, 20 deletions
diff --git a/src/exchange/taler-exchange-httpd.c b/src/exchange/taler-exchange-httpd.c
index 4208e4ca..3b8d6ed8 100644
--- a/src/exchange/taler-exchange-httpd.c
+++ b/src/exchange/taler-exchange-httpd.c
@@ -381,7 +381,8 @@ proceed_with_handler (const struct TEH_RequestHandler *rh,
GNUNET_assert (NULL == root);
return MHD_NO; /* bad upload, could not even generate error */
}
- if ( (GNUNET_NO == res) || (NULL == root) )
+ if ( (GNUNET_NO == res) ||
+ (NULL == root) )
{
GNUNET_assert (NULL == root);
return MHD_YES; /* so far incomplete upload or parser error */
@@ -427,8 +428,7 @@ proceed_with_handler (const struct TEH_RequestHandler *rh,
rh->url,
url);
GNUNET_break_op (0);
- if (NULL != root)
- json_decref (root);
+ json_decref (root);
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_NOT_FOUND,
TALER_EC_EXCHANGE_GENERIC_WRONG_NUMBER_OF_SEGMENTS,
@@ -454,8 +454,7 @@ proceed_with_handler (const struct TEH_RequestHandler *rh,
connection,
args);
}
- if (NULL != root)
- json_decref (root);
+ json_decref (root);
return ret;
}
diff --git a/src/exchange/taler-exchange-httpd_keys.c b/src/exchange/taler-exchange-httpd_keys.c
index c85b2c56..df49b93f 100644
--- a/src/exchange/taler-exchange-httpd_keys.c
+++ b/src/exchange/taler-exchange-httpd_keys.c
@@ -519,7 +519,7 @@ check_esign_sm_pub (const struct TALER_SecurityModulePublicKeyP *sm_pub)
* Helper function for #destroy_key_helpers to free all entries
* in the `denom_keys` map.
*
- * @param cls the `struct HelperState`
+ * @param cls the `struct HelperDenomination`
* @param h_denom_pub hash of the denomination public key
* @param value the `struct HelperDenomination` to release
* @return #GNUNET_OK (continue to iterate)
@@ -544,7 +544,7 @@ free_denom_cb (void *cls,
* Helper function for #destroy_key_helpers to free all entries
* in the `esign_keys` map.
*
- * @param cls the `struct HelperState`
+ * @param cls the `struct HelperSignkey`
* @param pid unused, matches the exchange public key
* @param value the `struct HelperSignkey` to release
* @return #GNUNET_OK (continue to iterate)
@@ -582,11 +582,6 @@ destroy_key_helpers (struct HelperState *hs)
hs);
GNUNET_CONTAINER_multipeermap_destroy (hs->esign_keys);
hs->esign_keys = NULL;
- if (NULL != hs->management_keys_reply)
- {
- json_decref (hs->management_keys_reply);
- hs->management_keys_reply = NULL;
- }
if (NULL != hs->dh)
{
TALER_CRYPTO_helper_denom_disconnect (hs->dh);
@@ -597,6 +592,11 @@ destroy_key_helpers (struct HelperState *hs)
TALER_CRYPTO_helper_esign_disconnect (hs->esh);
hs->esh = NULL;
}
+ if (NULL != hs->management_keys_reply)
+ {
+ json_decref (hs->management_keys_reply);
+ hs->management_keys_reply = NULL;
+ }
}
@@ -1777,7 +1777,7 @@ get_key_state (bool management_only)
GNUNET_break (0);
if (NULL != ksh)
destroy_key_state (ksh,
- false);
+ (NULL == old_ksh));
return NULL;
}
if (NULL != old_ksh)
@@ -2463,9 +2463,6 @@ TEH_keys_management_get_handler (const struct TEH_RequestHandler *rh,
GNUNET_JSON_from_data_auto (&esign_sm_pub));
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
"Returning GET /management/keys response:\n");
- json_dumpf (reply,
- stderr,
- JSON_INDENT (2));
if (NULL == reply)
return TALER_MHD_reply_with_error (connection,
MHD_HTTP_INTERNAL_SERVER_ERROR,
diff --git a/src/exchange/taler-exchange-httpd_management_post_keys.c b/src/exchange/taler-exchange-httpd_management_post_keys.c
index 1e793653..18f4c1b3 100644
--- a/src/exchange/taler-exchange-httpd_management_post_keys.c
+++ b/src/exchange/taler-exchange-httpd_management_post_keys.c
@@ -434,6 +434,8 @@ TEH_handler_management_post_keys (
&ret,
&add_keys,
&akc);
+ GNUNET_free (akc.d_sigs);
+ GNUNET_free (akc.s_sigs);
if (qs < 0)
return ret;
TEH_keys_update_states ();
diff --git a/src/exchange/taler-exchange-httpd_wire.c b/src/exchange/taler-exchange-httpd_wire.c
index 1942c7e4..e01355c6 100644
--- a/src/exchange/taler-exchange-httpd_wire.c
+++ b/src/exchange/taler-exchange-httpd_wire.c
@@ -280,12 +280,18 @@ build_wire_state (void)
}
}
wire_reply = json_pack (
- "{s:O, s:O, s:o}",
- "accounts", wire_accounts_array,
- "fees", wire_fee_object,
+ "{s:o, s:o, s:o}",
+ "accounts",
+ wire_accounts_array,
+ "fees",
+ wire_fee_object,
"master_public_key",
GNUNET_JSON_from_data_auto (&TEH_master_public_key));
- GNUNET_assert (NULL != wire_reply);
+ if (NULL == wire_reply)
+ {
+ GNUNET_break (0);
+ return NULL;
+ }
{
struct WireStateHandle *wsh;
diff --git a/src/exchangedb/exchangedb_accounts.c b/src/exchangedb/exchangedb_accounts.c
index 922ab6da..e5683983 100644
--- a/src/exchangedb/exchangedb_accounts.c
+++ b/src/exchangedb/exchangedb_accounts.c
@@ -121,6 +121,7 @@ check_for_account (void *cls,
ctx->cb (ctx->cb_cls,
&ai);
}
+ GNUNET_free (payto_uri);
GNUNET_free (method);
}
diff --git a/src/util/crypto_helper_denom.c b/src/util/crypto_helper_denom.c
index a70d071d..59fefc27 100644
--- a/src/util/crypto_helper_denom.c
+++ b/src/util/crypto_helper_denom.c
@@ -220,6 +220,7 @@ TALER_CRYPTO_helper_denom_connect (
strncpy (dh->sa.sun_path,
unixpath,
sizeof (dh->sa.sun_path) - 1);
+ GNUNET_free (unixpath);
dh->sock = -1;
{
char *tmpdir;
diff --git a/src/util/crypto_helper_esign.c b/src/util/crypto_helper_esign.c
index 3759d0c8..9392fe40 100644
--- a/src/util/crypto_helper_esign.c
+++ b/src/util/crypto_helper_esign.c
@@ -221,6 +221,7 @@ TALER_CRYPTO_helper_esign_connect (
strncpy (esh->sa.sun_path,
unixpath,
sizeof (esh->sa.sun_path) - 1);
+ GNUNET_free (unixpath);
esh->sock = -1;
{
char *tmpdir;
diff --git a/src/util/taler-exchange-secmod-eddsa.c b/src/util/taler-exchange-secmod-eddsa.c
index e8670d97..1c217e0b 100644
--- a/src/util/taler-exchange-secmod-eddsa.c
+++ b/src/util/taler-exchange-secmod-eddsa.c
@@ -564,6 +564,7 @@ handle_done (void *cls)
(key->purge) )
free_key (key);
}
+ GNUNET_free (wi->purpose);
GNUNET_free (wi);
GNUNET_assert (0 == pthread_mutex_lock (&done_lock));
}
diff --git a/src/util/taler-exchange-secmod-rsa.c b/src/util/taler-exchange-secmod-rsa.c
index ebd2d375..d2e44e70 100644
--- a/src/util/taler-exchange-secmod-rsa.c
+++ b/src/util/taler-exchange-secmod-rsa.c
@@ -614,6 +614,8 @@ handle_done (void *cls)
buf_size = GNUNET_CRYPTO_rsa_signature_encode (wi->rsa_signature,
&buf);
+ GNUNET_CRYPTO_rsa_signature_free (wi->rsa_signature);
+ wi->rsa_signature = NULL;
tsize = sizeof (*sr) + buf_size;
GNUNET_assert (tsize < UINT16_MAX);
sr = GNUNET_malloc (tsize);
@@ -638,6 +640,7 @@ handle_done (void *cls)
(dk->purge) )
free_dk (dk);
}
+ GNUNET_free (wi->blinded_msg);
GNUNET_free (wi);
GNUNET_assert (0 == pthread_mutex_lock (&done_lock));
}