From 171a5677d1e82e624909e44123fc521a8d0038a8 Mon Sep 17 00:00:00 2001 From: Alexander Bushnev Date: Wed, 25 Sep 2024 20:02:55 +0200 Subject: [PATCH] Fix potential segfault during multicast cleanup --- src/system/unix/network.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/system/unix/network.c b/src/system/unix/network.c index 4e1b21036..03b00ea1d 100644 --- a/src/system/unix/network.c +++ b/src/system/unix/network.c @@ -501,7 +501,9 @@ void _z_close_udp_multicast(_z_sys_net_socket_t *sockrecv, _z_sys_net_socket_t * // Required to be compliant with MISRA 15.7 rule } #if defined(ZENOH_LINUX) - z_free(lep._iptcp->ai_addr); + if (lep._iptcp != NULL) { + z_free(lep._iptcp->ai_addr); + } #else _ZP_UNUSED(lep); #endif