From c72a7b32a1e266debd7aff9f5712965c18a86fd2 Mon Sep 17 00:00:00 2001 From: Jon Shallow Date: Fri, 18 Oct 2024 12:57:28 +0100 Subject: [PATCH] Contiki: Fix heapmem_free() warning heapmem_free() warns if ptr is NULL. --- src/coap_mem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/coap_mem.c b/src/coap_mem.c index a1a524a86d..c8e463d274 100644 --- a/src/coap_mem.c +++ b/src/coap_mem.c @@ -654,7 +654,8 @@ coap_free_type(coap_memory_tag_t type, void *ptr) { if (ptr) track_counts[type]--; #endif /* COAP_MEMORY_TYPE_TRACK */ - heapmem_free(ptr); + if (ptr) + heapmem_free(ptr); } #endif /* WITH_CONTIKI */