summaryrefslogtreecommitdiffstats
path: root/src/network/netdev
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/netdev')
-rw-r--r--src/network/netdev/l2tp-tunnel.c8
-rw-r--r--src/network/netdev/macsec.c18
-rw-r--r--src/network/netdev/wireguard.c6
3 files changed, 15 insertions, 17 deletions
diff --git a/src/network/netdev/l2tp-tunnel.c b/src/network/netdev/l2tp-tunnel.c
index e302a2cf3b..a909b15764 100644
--- a/src/network/netdev/l2tp-tunnel.c
+++ b/src/network/netdev/l2tp-tunnel.c
@@ -39,18 +39,16 @@ static const char* const l2tp_local_address_type_table[_NETDEV_L2TP_LOCAL_ADDRES
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_FROM_STRING(l2tp_local_address_type, L2tpLocalAddressType);
-static void l2tp_session_free(L2tpSession *s) {
+static L2tpSession* l2tp_session_free(L2tpSession *s) {
if (!s)
- return;
+ return NULL;
if (s->tunnel && s->section)
ordered_hashmap_remove(s->tunnel->sessions_by_section, s->section);
network_config_section_free(s->section);
-
free(s->name);
-
- free(s);
+ return mfree(s);
}
DEFINE_NETWORK_SECTION_FUNCTIONS(L2tpSession, l2tp_session_free);
diff --git a/src/network/netdev/macsec.c b/src/network/netdev/macsec.c
index bef5ba1c51..77c5f8c4e7 100644
--- a/src/network/netdev/macsec.c
+++ b/src/network/netdev/macsec.c
@@ -35,9 +35,9 @@ static void security_association_init(SecurityAssociation *sa) {
sa->use_for_encoding = -1;
}
-static void macsec_receive_association_free(ReceiveAssociation *c) {
+static ReceiveAssociation* macsec_receive_association_free(ReceiveAssociation *c) {
if (!c)
- return;
+ return NULL;
if (c->macsec && c->section)
ordered_hashmap_remove(c->macsec->receive_associations_by_section, c->section);
@@ -45,7 +45,7 @@ static void macsec_receive_association_free(ReceiveAssociation *c) {
network_config_section_free(c->section);
security_association_clear(&c->sa);
- free(c);
+ return mfree(c);
}
DEFINE_NETWORK_SECTION_FUNCTIONS(ReceiveAssociation, macsec_receive_association_free);
@@ -90,9 +90,9 @@ static int macsec_receive_association_new_static(MACsec *s, const char *filename
return 0;
}
-static void macsec_receive_channel_free(ReceiveChannel *c) {
+static ReceiveChannel* macsec_receive_channel_free(ReceiveChannel *c) {
if (!c)
- return;
+ return NULL;
if (c->macsec) {
if (c->sci.as_uint64 > 0)
@@ -104,7 +104,7 @@ static void macsec_receive_channel_free(ReceiveChannel *c) {
network_config_section_free(c->section);
- free(c);
+ return mfree(c);
}
DEFINE_NETWORK_SECTION_FUNCTIONS(ReceiveChannel, macsec_receive_channel_free);
@@ -162,9 +162,9 @@ static int macsec_receive_channel_new_static(MACsec *s, const char *filename, un
return 0;
}
-static void macsec_transmit_association_free(TransmitAssociation *a) {
+static TransmitAssociation* macsec_transmit_association_free(TransmitAssociation *a) {
if (!a)
- return;
+ return NULL;
if (a->macsec && a->section)
ordered_hashmap_remove(a->macsec->transmit_associations_by_section, a->section);
@@ -172,7 +172,7 @@ static void macsec_transmit_association_free(TransmitAssociation *a) {
network_config_section_free(a->section);
security_association_clear(&a->sa);
- free(a);
+ return mfree(a);
}
DEFINE_NETWORK_SECTION_FUNCTIONS(TransmitAssociation, macsec_transmit_association_free);
diff --git a/src/network/netdev/wireguard.c b/src/network/netdev/wireguard.c
index e442ecc266..75d6d376a5 100644
--- a/src/network/netdev/wireguard.c
+++ b/src/network/netdev/wireguard.c
@@ -26,11 +26,11 @@
static void resolve_endpoints(NetDev *netdev);
-static void wireguard_peer_free(WireguardPeer *peer) {
+static WireguardPeer* wireguard_peer_free(WireguardPeer *peer) {
WireguardIPmask *mask;
if (!peer)
- return;
+ return NULL;
if (peer->wireguard) {
LIST_REMOVE(peers, peer->wireguard->peers, peer);
@@ -54,7 +54,7 @@ static void wireguard_peer_free(WireguardPeer *peer) {
free(peer->preshared_key_file);
explicit_bzero_safe(peer->preshared_key, WG_KEY_LEN);
- free(peer);
+ return mfree(peer);
}
DEFINE_NETWORK_SECTION_FUNCTIONS(WireguardPeer, wireguard_peer_free);