From 9fe602a17ca9de244eb4c97df613c9c7509cc3ad Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Wed, 13 Nov 2019 15:42:32 +0100 Subject: [PATCH] lib: make rcu_free() NULL-safe Signed-off-by: David Lamparter --- lib/frrcu.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/frrcu.h b/lib/frrcu.h index 8f789303cc..06d87c39f1 100644 --- a/lib/frrcu.h +++ b/lib/frrcu.h @@ -139,6 +139,8 @@ extern void rcu_enqueue(struct rcu_head *head, const struct rcu_action *action); #define rcu_free(mtype, ptr, field) \ do { \ typeof(ptr) _ptr = (ptr); \ + if (!_ptr) \ + break; \ struct rcu_head *_rcu_head = &_ptr->field; \ static const struct rcu_action _rcu_action = { \ .type = RCUA_FREE, \ -- 2.39.5