From 671e964d4309f6db1ecc592986a98133873a1404 Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Sun, 20 Nov 2016 03:46:53 -0500 Subject: [PATCH] only call HOOK_DESTROY callback if hook supports it --- lib/hooks.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/hooks.c b/lib/hooks.c index 5eb56c7ee..15492a52d 100644 --- a/lib/hooks.c +++ b/lib/hooks.c @@ -36,7 +36,9 @@ int hook_init(struct hook *h, struct list *nodes, struct list *paths, struct set void hook_destroy(struct hook *h) { struct hook_info i = { NULL }; - h->cb(h, HOOK_DESTROY, &i); + + if (h->type & HOOK_DESTROY) + h->cb(h, HOOK_DESTROY, &i); } int hook_copy(struct hook *h, struct hook *c)