summaryrefslogtreecommitdiff
path: root/src/transport
diff options
context:
space:
mode:
authorLRN <lrn1986@gmail.com>2013-12-19 06:00:23 +0000
committerLRN <lrn1986@gmail.com>2013-12-19 06:00:23 +0000
commite0ca7357cd0bfedc5c29cb731b56279fef8da059 (patch)
treeecfd47cf59bc00e656b53fd59c58f5038e342d65 /src/transport
parent92fd84dc7ef98452f848a62677c61a2b80b5835e (diff)
malloc -> new
Diffstat (limited to 'src/transport')
-rw-r--r--src/transport/gnunet-service-transport_blacklist.c6
-rw-r--r--src/transport/gnunet-service-transport_clients.c2
-rw-r--r--src/transport/gnunet-service-transport_hello.c2
-rw-r--r--src/transport/gnunet-service-transport_manipulation.c4
-rw-r--r--src/transport/gnunet-service-transport_validation.c2
-rw-r--r--src/transport/plugin_transport_bluetooth.c14
-rw-r--r--src/transport/plugin_transport_http_common.c4
-rw-r--r--src/transport/plugin_transport_http_server.c6
-rw-r--r--src/transport/plugin_transport_smtp.c4
-rw-r--r--src/transport/plugin_transport_tcp.c4
-rw-r--r--src/transport/plugin_transport_udp.c6
-rw-r--r--src/transport/plugin_transport_udp_broadcasting.c4
-rw-r--r--src/transport/plugin_transport_wlan.c14
-rw-r--r--src/transport/transport-testing.c6
-rw-r--r--src/transport/transport_api_address_lookup.c2
-rw-r--r--src/transport/transport_api_address_to_string.c2
-rw-r--r--src/transport/transport_api_blacklist.c2
17 files changed, 42 insertions, 42 deletions
diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c
index 87d753929..db154d911 100644
--- a/src/transport/gnunet-service-transport_blacklist.c
+++ b/src/transport/gnunet-service-transport_blacklist.c
@@ -494,7 +494,7 @@ test_connection_ok (void *cls, const struct GNUNET_PeerIdentity *neighbour,
struct TestConnectionContext *tcc = cls;
struct GST_BlacklistCheck *bc;
- bc = GNUNET_malloc (sizeof (struct GST_BlacklistCheck));
+ bc = GNUNET_new (struct GST_BlacklistCheck);
GNUNET_CONTAINER_DLL_insert (bc_head, bc_tail, bc);
bc->peer = *neighbour;
bc->cont = &confirm_or_drop_neighbour;
@@ -538,7 +538,7 @@ GST_blacklist_handle_init (void *cls, struct GNUNET_SERVER_Client *client,
bl = bl->next;
}
GNUNET_SERVER_client_mark_monitor (client);
- bl = GNUNET_malloc (sizeof (struct Blacklisters));
+ bl = GNUNET_new (struct Blacklisters);
bl->client = client;
GNUNET_SERVER_client_keep (client);
GNUNET_CONTAINER_DLL_insert_after (bl_head, bl_tail, bl_tail, bl);
@@ -739,7 +739,7 @@ GST_blacklist_test_allowed (const struct GNUNET_PeerIdentity *peer,
}
/* need to query blacklist clients */
- bc = GNUNET_malloc (sizeof (struct GST_BlacklistCheck));
+ bc = GNUNET_new (struct GST_BlacklistCheck);
GNUNET_CONTAINER_DLL_insert (bc_head, bc_tail, bc);
bc->peer = *peer;
bc->cont = cont;
diff --git a/src/transport/gnunet-service-transport_clients.c b/src/transport/gnunet-service-transport_clients.c
index 0aeb661d4..8679f40b4 100644
--- a/src/transport/gnunet-service-transport_clients.c
+++ b/src/transport/gnunet-service-transport_clients.c
@@ -677,7 +677,7 @@ clients_handle_send (void *cls,
return;
}
GNUNET_SERVER_receive_done (client, GNUNET_OK);
- stcc = GNUNET_malloc (sizeof (struct SendTransmitContinuationContext));
+ stcc = GNUNET_new (struct SendTransmitContinuationContext);
stcc->target = obm->peer;
stcc->client = client;
GNUNET_SERVER_client_keep (client);
diff --git a/src/transport/gnunet-service-transport_hello.c b/src/transport/gnunet-service-transport_hello.c
index 6bf707755..626be54c1 100644
--- a/src/transport/gnunet-service-transport_hello.c
+++ b/src/transport/gnunet-service-transport_hello.c
@@ -288,7 +288,7 @@ GST_hello_modify_addresses (int addremove,
GNUNET_break (0);
return;
}
- al = GNUNET_malloc (sizeof (struct OwnAddressList));
+ al = GNUNET_new (struct OwnAddressList);
GNUNET_CONTAINER_DLL_insert (oal_head, oal_tail, al);
al->address = GNUNET_HELLO_address_copy (address);
refresh_hello ();
diff --git a/src/transport/gnunet-service-transport_manipulation.c b/src/transport/gnunet-service-transport_manipulation.c
index 1b708cb70..da3fc2de9 100644
--- a/src/transport/gnunet-service-transport_manipulation.c
+++ b/src/transport/gnunet-service-transport_manipulation.c
@@ -210,7 +210,7 @@ set_metric (struct TM_Peer *dest, int direction, uint32_t type, uint32_t value)
}
if (NULL == cur)
{
- cur = GNUNET_malloc (sizeof (struct PropManipulationEntry));
+ cur = GNUNET_new (struct PropManipulationEntry);
GNUNET_CONTAINER_DLL_insert (dest->head, dest->tail, cur);
cur->type = type;
cur->metrics[TM_SEND] = UINT32_MAX;
@@ -327,7 +327,7 @@ GST_manipulation_set_metric (void *cls, struct GNUNET_SERVER_Client *client,
if (NULL == (tmp = GNUNET_CONTAINER_multipeermap_get (man_handle.peers, &tm->peer)))
{
- tmp = GNUNET_malloc (sizeof (struct TM_Peer));
+ tmp = GNUNET_new (struct TM_Peer);
tmp->peer = (tm->peer);
for (c = 0; c < TM_BOTH; c++)
{
diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c
index c0e605114..d56aac8ad 100644
--- a/src/transport/gnunet-service-transport_validation.c
+++ b/src/transport/gnunet-service-transport_validation.c
@@ -718,7 +718,7 @@ find_validation_entry (const struct GNUNET_CRYPTO_EddsaPublicKey *public_key,
return ve;
if (public_key == NULL)
return NULL;
- ve = GNUNET_malloc (sizeof (struct ValidationEntry));
+ ve = GNUNET_new (struct ValidationEntry);
ve->in_use = GNUNET_SYSERR; /* not defined */
ve->last_line_set_to_no = 0;
ve->last_line_set_to_yes = 0;
diff --git a/src/transport/plugin_transport_bluetooth.c b/src/transport/plugin_transport_bluetooth.c
index 51e8a89bd..a7d3cf3f5 100644
--- a/src/transport/plugin_transport_bluetooth.c
+++ b/src/transport/plugin_transport_bluetooth.c
@@ -730,7 +730,7 @@ create_session (struct MacEndpoint *endpoint,
}
GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# Bluetooth sessions allocated"), 1,
GNUNET_NO);
- session = GNUNET_malloc (sizeof (struct Session));
+ session = GNUNET_new (struct Session);
GNUNET_CONTAINER_DLL_insert_tail (endpoint->sessions_head,
endpoint->sessions_tail,
session);
@@ -897,7 +897,7 @@ send_with_fragmentation (struct MacEndpoint *endpoint,
struct Plugin *plugin;
plugin = endpoint->plugin;
- fm = GNUNET_malloc (sizeof (struct FragmentMessage));
+ fm = GNUNET_new (struct FragmentMessage);
fm->macendpoint = endpoint;
fm->target = *target;
fm->size_payload = payload_size;
@@ -1001,7 +1001,7 @@ create_macendpoint (struct Plugin *plugin,
for (pos = plugin->mac_head; NULL != pos; pos = pos->next)
if (0 == memcmp (addr, &pos->addr, sizeof (struct WlanAddress)))
return pos;
- pos = GNUNET_malloc (sizeof (struct MacEndpoint));
+ pos = GNUNET_new (struct MacEndpoint);
pos->addr = *addr;
pos->plugin = plugin;
pos->defrag =
@@ -1790,7 +1790,7 @@ bluetooth_string_to_address (void *cls, const char *addr, uint16_t addrlen,
GNUNET_break (0);
return GNUNET_SYSERR;
}
- wa = GNUNET_malloc (sizeof (struct WlanAddress));
+ wa = GNUNET_new (struct WlanAddress);
for (i=0;i<6;i++)
wa->mac.mac[i] = a[i];
wa->options = htonl (0);
@@ -1833,7 +1833,7 @@ libgnunet_plugin_transport_bluetooth_init (void *cls)
{
/* run in 'stub' mode (i.e. as part of gnunet-peerinfo), don't fully
initialze the plugin or the API */
- api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
+ api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
api->cls = NULL;
api->address_pretty_printer = &bluetooth_plugin_address_pretty_printer;
api->address_to_string = &bluetooth_plugin_address_to_string;
@@ -1875,7 +1875,7 @@ libgnunet_plugin_transport_bluetooth_init (void *cls)
return NULL;
}
- plugin = GNUNET_malloc (sizeof (struct Plugin));
+ plugin = GNUNET_new (struct Plugin);
plugin->interface = interface;
plugin->env = env;
GNUNET_STATISTICS_set (plugin->env->stats, _("# Bluetooth sessions allocated"),
@@ -1933,7 +1933,7 @@ libgnunet_plugin_transport_bluetooth_init (void *cls)
GNUNET_assert (0);
}
- api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
+ api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
api->cls = plugin;
api->send = &bluetooth_plugin_send;
api->get_session = &bluetooth_plugin_get_session;
diff --git a/src/transport/plugin_transport_http_common.c b/src/transport/plugin_transport_http_common.c
index de4cb9a26..c020118ac 100644
--- a/src/transport/plugin_transport_http_common.c
+++ b/src/transport/plugin_transport_http_common.c
@@ -60,7 +60,7 @@ http_split_address (const char * addr)
char *port_start = NULL;
char *path_start = NULL;
protocol_start = src;
- sp = GNUNET_malloc (sizeof (struct SplittedHTTPAddress));
+ sp = GNUNET_new (struct SplittedHTTPAddress);
/* Address string consists of protocol://host[:port]path*/
@@ -455,7 +455,7 @@ http_common_socket_from_address (const void *addr, size_t addrlen, int *res)
return NULL;
}
- s = GNUNET_malloc (sizeof (struct sockaddr_storage));
+ s = GNUNET_new (struct sockaddr_storage);
GNUNET_asprintf (&to_conv, "%s:%u", spa->host, spa->port);
if (GNUNET_SYSERR == GNUNET_STRINGS_to_address_ip (to_conv, strlen(to_conv), s))
{
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index f08c7072a..15c0323c6 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -2219,7 +2219,7 @@ server_add_address (void *cls, int add_remove, const struct sockaddr *addr,
struct HTTP_Server_Plugin *plugin = cls;
struct HttpAddressWrapper *w = NULL;
- w = GNUNET_malloc (sizeof (struct HttpAddressWrapper));
+ w = GNUNET_new (struct HttpAddressWrapper);
w->address = http_common_address_from_socket (plugin->protocol, addr, addrlen);
if (NULL == w->address)
{
@@ -2769,7 +2769,7 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin)
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
"Binding %s plugin to specific IPv4 address: `%s'\n",
plugin->protocol, bind4_address);
- plugin->server_addr_v4 = GNUNET_malloc (sizeof (struct sockaddr_in));
+ plugin->server_addr_v4 = GNUNET_new (struct sockaddr_in);
if (1 != inet_pton (AF_INET, bind4_address,
&plugin->server_addr_v4->sin_addr))
{
@@ -2800,7 +2800,7 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin)
GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
"Binding %s plugin to specific IPv6 address: `%s'\n",
plugin->protocol, bind6_address);
- plugin->server_addr_v6 = GNUNET_malloc (sizeof (struct sockaddr_in6));
+ plugin->server_addr_v6 = GNUNET_new (struct sockaddr_in6);
if (1 !=
inet_pton (AF_INET6, bind6_address, &plugin->server_addr_v6->sin6_addr))
{
diff --git a/src/transport/plugin_transport_smtp.c b/src/transport/plugin_transport_smtp.c
index c886fd132..fd2089367 100644
--- a/src/transport/plugin_transport_smtp.c
+++ b/src/transport/plugin_transport_smtp.c
@@ -233,7 +233,7 @@ listenAndDistribute (void *unused)
}
if (stats != NULL)
stats->change (stat_bytesReceived, size);
- coreMP = GNUNET_malloc (sizeof (GNUNET_TransportPacket));
+ coreMP = GNUNET_new (GNUNET_TransportPacket);
coreMP->msg = out;
coreMP->size = size - sizeof (SMTPMessage);
coreMP->tsession = NULL;
@@ -541,7 +541,7 @@ api_connect (const GNUNET_MessageHello * hello, GNUNET_TSession ** tsessionPtr,
{
GNUNET_TSession *tsession;
- tsession = GNUNET_malloc (sizeof (GNUNET_TSession));
+ tsession = GNUNET_new (GNUNET_TSession);
tsession->internal = GNUNET_malloc (GNUNET_sizeof_hello (hello));
tsession->peer = hello->senderIdentity;
memcpy (tsession->internal, hello, GNUNET_sizeof_hello (hello));
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index d3f27dec4..04fac9cde 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -1906,7 +1906,7 @@ tcp_plugin_address_pretty_printer (void *cls, const char *type,
asc (asc_cls, NULL);
return;
}
- ppc = GNUNET_malloc (sizeof (struct PrettyPrinterContext));
+ ppc = GNUNET_new (struct PrettyPrinterContext);
if (addrlen == sizeof (struct IPv6TcpAddress))
ppc->ipv6 = GNUNET_YES;
else
@@ -2524,7 +2524,7 @@ try_connection_reversal (void *cls, const struct sockaddr *addr,
/* FIXME: do we need to track these probe context objects so that
* we can clean them up on plugin unload? */
- tcp_probe_ctx = GNUNET_malloc (sizeof (struct TCPProbeContext));
+ tcp_probe_ctx = GNUNET_new (struct TCPProbeContext);
tcp_probe_ctx->message.header.size =
htons (sizeof (struct TCP_NAT_ProbeMessage));
tcp_probe_ctx->message.header.type =
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index 5b46c93c7..a5ee6494a 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -684,7 +684,7 @@ udp_string_to_address (void *cls, const char *addr, uint16_t addrlen,
{
struct IPv4UdpAddress *u4;
struct sockaddr_in *in4 = (struct sockaddr_in *) &socket_address;
- u4 = GNUNET_malloc (sizeof (struct IPv4UdpAddress));
+ u4 = GNUNET_new (struct IPv4UdpAddress);
u4->options = htonl (options);
u4->ipv4_addr = in4->sin_addr.s_addr;
u4->u4_port = in4->sin_port;
@@ -696,7 +696,7 @@ udp_string_to_address (void *cls, const char *addr, uint16_t addrlen,
{
struct IPv6UdpAddress *u6;
struct sockaddr_in6 *in6 = (struct sockaddr_in6 *) &socket_address;
- u6 = GNUNET_malloc (sizeof (struct IPv6UdpAddress));
+ u6 = GNUNET_new (struct IPv6UdpAddress);
u6->options = htonl (options);
u6->ipv6_addr = in6->sin6_addr;
u6->u6_port = in6->sin6_port;
@@ -1911,7 +1911,7 @@ udp_plugin_send (void *cls,
if (s->frag_ctx != NULL)
return GNUNET_SYSERR;
memcpy (&udp[1], msgbuf, msgbuf_size);
- frag_ctx = GNUNET_malloc (sizeof (struct UDP_FragmentationContext));
+ frag_ctx = GNUNET_new (struct UDP_FragmentationContext);
frag_ctx->plugin = plugin;
frag_ctx->session = s;
frag_ctx->cont = cont;
diff --git a/src/transport/plugin_transport_udp_broadcasting.c b/src/transport/plugin_transport_udp_broadcasting.c
index 61ac3d10e..5448b4eff 100644
--- a/src/transport/plugin_transport_udp_broadcasting.c
+++ b/src/transport/plugin_transport_udp_broadcasting.c
@@ -242,7 +242,7 @@ udp_broadcast_receive (struct Plugin *plugin,
size, GNUNET_a2s ((const struct sockaddr *) addr, addrlen));
struct Mstv4Context *mc;
- mc = GNUNET_malloc (sizeof (struct Mstv4Context));
+ mc = GNUNET_new (struct Mstv4Context);
struct sockaddr_in *av4 = (struct sockaddr_in *) addr;
mc->addr.ipv4_addr = av4->sin_addr.s_addr;
@@ -263,7 +263,7 @@ udp_broadcast_receive (struct Plugin *plugin,
size, GNUNET_a2s ((const struct sockaddr *) &addr, addrlen));
struct Mstv6Context *mc;
- mc = GNUNET_malloc (sizeof (struct Mstv6Context));
+ mc = GNUNET_new (struct Mstv6Context);
struct sockaddr_in6 *av6 = (struct sockaddr_in6 *) addr;
mc->addr.ipv6_addr = av6->sin6_addr;
diff --git a/src/transport/plugin_transport_wlan.c b/src/transport/plugin_transport_wlan.c
index 6f5c66ad3..1fafc4070 100644
--- a/src/transport/plugin_transport_wlan.c
+++ b/src/transport/plugin_transport_wlan.c
@@ -777,7 +777,7 @@ create_session (struct MacEndpoint *endpoint,
GNUNET_STATISTICS_update (endpoint->plugin->env->stats, _("# WLAN sessions allocated"), 1,
GNUNET_NO);
- session = GNUNET_malloc (sizeof (struct Session));
+ session = GNUNET_new (struct Session);
GNUNET_CONTAINER_DLL_insert_tail (endpoint->sessions_head,
endpoint->sessions_tail,
session);
@@ -974,7 +974,7 @@ send_with_fragmentation (struct MacEndpoint *endpoint,
struct Plugin *plugin;
plugin = endpoint->plugin;
- fm = GNUNET_malloc (sizeof (struct FragmentMessage));
+ fm = GNUNET_new (struct FragmentMessage);
fm->macendpoint = endpoint;
fm->target = *target;
fm->size_payload = payload_size;
@@ -1079,7 +1079,7 @@ create_macendpoint (struct Plugin *plugin,
for (pos = plugin->mac_head; NULL != pos; pos = pos->next)
if (0 == memcmp (addr, &pos->addr, sizeof (struct WlanAddress)))
return pos;
- pos = GNUNET_malloc (sizeof (struct MacEndpoint));
+ pos = GNUNET_new (struct MacEndpoint);
pos->addr = *addr;
pos->plugin = plugin;
pos->defrag =
@@ -1846,7 +1846,7 @@ wlan_string_to_address (void *cls, const char *addr, uint16_t addrlen,
GNUNET_break (0);
return GNUNET_SYSERR;
}
- wa = GNUNET_malloc (sizeof (struct WlanAddress));
+ wa = GNUNET_new (struct WlanAddress);
for (i=0;i<6;i++)
wa->mac.mac[i] = a[i];
wa->options = htonl (0);
@@ -1889,7 +1889,7 @@ libgnunet_plugin_transport_wlan_init (void *cls)
{
/* run in 'stub' mode (i.e. as part of gnunet-peerinfo), don't fully
initialze the plugin or the API */
- api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
+ api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
api->cls = NULL;
api->address_pretty_printer = &wlan_plugin_address_pretty_printer;
api->address_to_string = &wlan_plugin_address_to_string;
@@ -1931,7 +1931,7 @@ libgnunet_plugin_transport_wlan_init (void *cls)
return NULL;
}
- plugin = GNUNET_malloc (sizeof (struct Plugin));
+ plugin = GNUNET_new (struct Plugin);
plugin->interface = interface;
plugin->env = env;
GNUNET_STATISTICS_set (plugin->env->stats, _("# WLAN sessions allocated"),
@@ -1989,7 +1989,7 @@ libgnunet_plugin_transport_wlan_init (void *cls)
GNUNET_assert (0);
}
- api = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PluginFunctions));
+ api = GNUNET_new (struct GNUNET_TRANSPORT_PluginFunctions);
api->cls = plugin;
api->send = &wlan_plugin_send;
api->get_session = &wlan_plugin_get_session;
diff --git a/src/transport/transport-testing.c b/src/transport/transport-testing.c
index 51aa0a55f..f9182b57f 100644
--- a/src/transport/transport-testing.c
+++ b/src/transport/transport-testing.c
@@ -246,7 +246,7 @@ GNUNET_TRANSPORT_TESTING_start_peer (struct GNUNET_TRANSPORT_TESTING_handle *tth
return NULL;
}
- struct PeerContext *p = GNUNET_malloc (sizeof (struct PeerContext));
+ struct PeerContext *p = GNUNET_new (struct PeerContext);
GNUNET_CONTAINER_DLL_insert (tth->p_head, tth->p_tail, p);
/* Create configuration and call testing lib to modify it */
@@ -471,7 +471,7 @@ GNUNET_TRANSPORT_TESTING_connect_peers (struct GNUNET_TRANSPORT_TESTING_handle *
GNUNET_assert (tth != NULL);
struct ConnectingContext *cc =
- GNUNET_malloc (sizeof (struct ConnectingContext));
+ GNUNET_new (struct ConnectingContext);
GNUNET_assert (p1 != NULL);
GNUNET_assert (p2 != NULL);
@@ -574,7 +574,7 @@ GNUNET_TRANSPORT_TESTING_init ()
struct GNUNET_TRANSPORT_TESTING_handle *tth;
/* prepare hostkeys */
- tth = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_TESTING_handle));
+ tth = GNUNET_new (struct GNUNET_TRANSPORT_TESTING_handle);
/* Init testing the testing lib */
tth->tl_system = GNUNET_TESTING_system_create ("transport-testing", NULL,
diff --git a/src/transport/transport_api_address_lookup.c b/src/transport/transport_api_address_lookup.c
index 515be9bf8..d547b8ed8 100644
--- a/src/transport/transport_api_address_lookup.c
+++ b/src/transport/transport_api_address_lookup.c
@@ -322,7 +322,7 @@ GNUNET_TRANSPORT_peer_get_active_addresses (const struct
return NULL;
if (GNUNET_YES != one_shot)
timeout = GNUNET_TIME_UNIT_FOREVER_REL;
- pal_ctx = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_PeerIterateContext));
+ pal_ctx = GNUNET_new (struct GNUNET_TRANSPORT_PeerIterateContext);
pal_ctx->cb = peer_address_callback;
pal_ctx->cb_cls = peer_address_callback_cls;
pal_ctx->cfg = cfg;
diff --git a/src/transport/transport_api_address_to_string.c b/src/transport/transport_api_address_to_string.c
index 94c9ac45a..0fb0623dc 100644
--- a/src/transport/transport_api_address_to_string.c
+++ b/src/transport/transport_api_address_to_string.c
@@ -152,7 +152,7 @@ GNUNET_TRANSPORT_address_to_string (const struct GNUNET_CONFIGURATION_Handle
memcpy (addrbuf, address->address, alen);
memcpy (&addrbuf[alen], address->transport_name, slen);
- alc = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_AddressToStringContext));
+ alc = GNUNET_new (struct GNUNET_TRANSPORT_AddressToStringContext);
alc->cb = aluc;
alc->cb_cls = aluc_cls;
alc->timeout = GNUNET_TIME_relative_to_absolute (timeout);
diff --git a/src/transport/transport_api_blacklist.c b/src/transport/transport_api_blacklist.c
index dcd1ae781..1c17bd498 100644
--- a/src/transport/transport_api_blacklist.c
+++ b/src/transport/transport_api_blacklist.c
@@ -256,7 +256,7 @@ GNUNET_TRANSPORT_blacklist (const struct GNUNET_CONFIGURATION_Handle *cfg,
client = GNUNET_CLIENT_connect ("transport", cfg);
if (NULL == client)
return NULL;
- ret = GNUNET_malloc (sizeof (struct GNUNET_TRANSPORT_Blacklist));
+ ret = GNUNET_new (struct GNUNET_TRANSPORT_Blacklist);
ret->client = client;
ret->cfg = cfg;
ret->cb = cb;