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

Serge E. Hallyn serue at us.ibm.com
Tue Sep 29 12:53:23 PDT 2009


Quoting Matt Helsley (matthltc at us.ibm.com):
> 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>

Trivial enough

Acked-by: Serge Hallyn <serue 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 Containers mailing list