fix memory leaks
This commit is contained in:
parent
cd17d095e8
commit
12deb6c267
@ -381,7 +381,8 @@ proceed_with_handler (const struct TEH_RequestHandler *rh,
|
|||||||
GNUNET_assert (NULL == root);
|
GNUNET_assert (NULL == root);
|
||||||
return MHD_NO; /* bad upload, could not even generate error */
|
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);
|
GNUNET_assert (NULL == root);
|
||||||
return MHD_YES; /* so far incomplete upload or parser error */
|
return MHD_YES; /* so far incomplete upload or parser error */
|
||||||
@ -427,7 +428,6 @@ proceed_with_handler (const struct TEH_RequestHandler *rh,
|
|||||||
rh->url,
|
rh->url,
|
||||||
url);
|
url);
|
||||||
GNUNET_break_op (0);
|
GNUNET_break_op (0);
|
||||||
if (NULL != root)
|
|
||||||
json_decref (root);
|
json_decref (root);
|
||||||
return TALER_MHD_reply_with_error (connection,
|
return TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_NOT_FOUND,
|
MHD_HTTP_NOT_FOUND,
|
||||||
@ -454,7 +454,6 @@ proceed_with_handler (const struct TEH_RequestHandler *rh,
|
|||||||
connection,
|
connection,
|
||||||
args);
|
args);
|
||||||
}
|
}
|
||||||
if (NULL != root)
|
|
||||||
json_decref (root);
|
json_decref (root);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -519,7 +519,7 @@ check_esign_sm_pub (const struct TALER_SecurityModulePublicKeyP *sm_pub)
|
|||||||
* Helper function for #destroy_key_helpers to free all entries
|
* Helper function for #destroy_key_helpers to free all entries
|
||||||
* in the `denom_keys` map.
|
* 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 h_denom_pub hash of the denomination public key
|
||||||
* @param value the `struct HelperDenomination` to release
|
* @param value the `struct HelperDenomination` to release
|
||||||
* @return #GNUNET_OK (continue to iterate)
|
* @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
|
* Helper function for #destroy_key_helpers to free all entries
|
||||||
* in the `esign_keys` map.
|
* in the `esign_keys` map.
|
||||||
*
|
*
|
||||||
* @param cls the `struct HelperState`
|
* @param cls the `struct HelperSignkey`
|
||||||
* @param pid unused, matches the exchange public key
|
* @param pid unused, matches the exchange public key
|
||||||
* @param value the `struct HelperSignkey` to release
|
* @param value the `struct HelperSignkey` to release
|
||||||
* @return #GNUNET_OK (continue to iterate)
|
* @return #GNUNET_OK (continue to iterate)
|
||||||
@ -582,11 +582,6 @@ destroy_key_helpers (struct HelperState *hs)
|
|||||||
hs);
|
hs);
|
||||||
GNUNET_CONTAINER_multipeermap_destroy (hs->esign_keys);
|
GNUNET_CONTAINER_multipeermap_destroy (hs->esign_keys);
|
||||||
hs->esign_keys = NULL;
|
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)
|
if (NULL != hs->dh)
|
||||||
{
|
{
|
||||||
TALER_CRYPTO_helper_denom_disconnect (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);
|
TALER_CRYPTO_helper_esign_disconnect (hs->esh);
|
||||||
hs->esh = NULL;
|
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);
|
GNUNET_break (0);
|
||||||
if (NULL != ksh)
|
if (NULL != ksh)
|
||||||
destroy_key_state (ksh,
|
destroy_key_state (ksh,
|
||||||
false);
|
(NULL == old_ksh));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (NULL != old_ksh)
|
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_JSON_from_data_auto (&esign_sm_pub));
|
||||||
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
|
||||||
"Returning GET /management/keys response:\n");
|
"Returning GET /management/keys response:\n");
|
||||||
json_dumpf (reply,
|
|
||||||
stderr,
|
|
||||||
JSON_INDENT (2));
|
|
||||||
if (NULL == reply)
|
if (NULL == reply)
|
||||||
return TALER_MHD_reply_with_error (connection,
|
return TALER_MHD_reply_with_error (connection,
|
||||||
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
MHD_HTTP_INTERNAL_SERVER_ERROR,
|
||||||
|
@ -434,6 +434,8 @@ TEH_handler_management_post_keys (
|
|||||||
&ret,
|
&ret,
|
||||||
&add_keys,
|
&add_keys,
|
||||||
&akc);
|
&akc);
|
||||||
|
GNUNET_free (akc.d_sigs);
|
||||||
|
GNUNET_free (akc.s_sigs);
|
||||||
if (qs < 0)
|
if (qs < 0)
|
||||||
return ret;
|
return ret;
|
||||||
TEH_keys_update_states ();
|
TEH_keys_update_states ();
|
||||||
|
@ -280,12 +280,18 @@ build_wire_state (void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
wire_reply = json_pack (
|
wire_reply = json_pack (
|
||||||
"{s:O, s:O, s:o}",
|
"{s:o, s:o, s:o}",
|
||||||
"accounts", wire_accounts_array,
|
"accounts",
|
||||||
"fees", wire_fee_object,
|
wire_accounts_array,
|
||||||
|
"fees",
|
||||||
|
wire_fee_object,
|
||||||
"master_public_key",
|
"master_public_key",
|
||||||
GNUNET_JSON_from_data_auto (&TEH_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;
|
struct WireStateHandle *wsh;
|
||||||
|
|
||||||
|
@ -121,6 +121,7 @@ check_for_account (void *cls,
|
|||||||
ctx->cb (ctx->cb_cls,
|
ctx->cb (ctx->cb_cls,
|
||||||
&ai);
|
&ai);
|
||||||
}
|
}
|
||||||
|
GNUNET_free (payto_uri);
|
||||||
GNUNET_free (method);
|
GNUNET_free (method);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,6 +220,7 @@ TALER_CRYPTO_helper_denom_connect (
|
|||||||
strncpy (dh->sa.sun_path,
|
strncpy (dh->sa.sun_path,
|
||||||
unixpath,
|
unixpath,
|
||||||
sizeof (dh->sa.sun_path) - 1);
|
sizeof (dh->sa.sun_path) - 1);
|
||||||
|
GNUNET_free (unixpath);
|
||||||
dh->sock = -1;
|
dh->sock = -1;
|
||||||
{
|
{
|
||||||
char *tmpdir;
|
char *tmpdir;
|
||||||
|
@ -221,6 +221,7 @@ TALER_CRYPTO_helper_esign_connect (
|
|||||||
strncpy (esh->sa.sun_path,
|
strncpy (esh->sa.sun_path,
|
||||||
unixpath,
|
unixpath,
|
||||||
sizeof (esh->sa.sun_path) - 1);
|
sizeof (esh->sa.sun_path) - 1);
|
||||||
|
GNUNET_free (unixpath);
|
||||||
esh->sock = -1;
|
esh->sock = -1;
|
||||||
{
|
{
|
||||||
char *tmpdir;
|
char *tmpdir;
|
||||||
|
@ -564,6 +564,7 @@ handle_done (void *cls)
|
|||||||
(key->purge) )
|
(key->purge) )
|
||||||
free_key (key);
|
free_key (key);
|
||||||
}
|
}
|
||||||
|
GNUNET_free (wi->purpose);
|
||||||
GNUNET_free (wi);
|
GNUNET_free (wi);
|
||||||
GNUNET_assert (0 == pthread_mutex_lock (&done_lock));
|
GNUNET_assert (0 == pthread_mutex_lock (&done_lock));
|
||||||
}
|
}
|
||||||
|
@ -614,6 +614,8 @@ handle_done (void *cls)
|
|||||||
|
|
||||||
buf_size = GNUNET_CRYPTO_rsa_signature_encode (wi->rsa_signature,
|
buf_size = GNUNET_CRYPTO_rsa_signature_encode (wi->rsa_signature,
|
||||||
&buf);
|
&buf);
|
||||||
|
GNUNET_CRYPTO_rsa_signature_free (wi->rsa_signature);
|
||||||
|
wi->rsa_signature = NULL;
|
||||||
tsize = sizeof (*sr) + buf_size;
|
tsize = sizeof (*sr) + buf_size;
|
||||||
GNUNET_assert (tsize < UINT16_MAX);
|
GNUNET_assert (tsize < UINT16_MAX);
|
||||||
sr = GNUNET_malloc (tsize);
|
sr = GNUNET_malloc (tsize);
|
||||||
@ -638,6 +640,7 @@ handle_done (void *cls)
|
|||||||
(dk->purge) )
|
(dk->purge) )
|
||||||
free_dk (dk);
|
free_dk (dk);
|
||||||
}
|
}
|
||||||
|
GNUNET_free (wi->blinded_msg);
|
||||||
GNUNET_free (wi);
|
GNUNET_free (wi);
|
||||||
GNUNET_assert (0 == pthread_mutex_lock (&done_lock));
|
GNUNET_assert (0 == pthread_mutex_lock (&done_lock));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user