[Devel] [PATCH 1/2] Check for valid destructor pointer before calling it.

Matt Helsley matthltc at us.ibm.com
Mon Sep 28 12:01:22 PDT 2009


Not every use of deferqueue will have a destructor function so
we need to check it before calling it.

Signed-off-by: Matt Helsley <matthltc at us.ibm.com>
---
 kernel/deferqueue.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/kernel/deferqueue.c b/kernel/deferqueue.c
index 3fb388b..1204c8b 100644
--- a/kernel/deferqueue.c
+++ b/kernel/deferqueue.c
@@ -53,7 +53,8 @@ void deferqueue_destroy(struct deferqueue_head *h)
 
 		pr_debug("%s: freeing non-empty queue\n", __func__);
 		list_for_each_entry_safe(dq, n, &h->list, list) {
-			dq->destructor(dq->data);
+			if (dq->destructor)
+				dq->destructor(dq->data);
 			list_del(&dq->list);
 			kfree(dq);
 		}
-- 
1.5.6.3


_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list