From e8c4e2958c3aa0bf5db41f5f2db5f6c5a5905fa5 Mon Sep 17 00:00:00 2001 From: Jean-Roland Date: Fri, 14 Jun 2024 15:56:03 +0200 Subject: [PATCH] fix: check for null value before in drop function --- src/api/api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/api.c b/src/api/api.c index 9bea1c9d8..b3ae48245 100644 --- a/src/api/api.c +++ b/src/api/api.c @@ -686,7 +686,7 @@ void z_closure_zid_call(const z_owned_closure_zid_t *closure, const z_id_t *id) return ret; \ } \ void z_##name##_drop(z_owned_##name##_t *obj) { \ - if (obj->_val != NULL) { \ + if ((obj != NULL) && (obj->_val != NULL)) { \ f_free(&obj->_val); \ } \ }