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);
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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 ();
|
||||
|
@ -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;
|
||||
|
||||
|
@ -121,6 +121,7 @@ check_for_account (void *cls,
|
||||
ctx->cb (ctx->cb_cls,
|
||||
&ai);
|
||||
}
|
||||
GNUNET_free (payto_uri);
|
||||
GNUNET_free (method);
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user