[Devel] Re: [PATCH 1/2] Check for valid destructor pointer before calling it.
Oren Laadan
orenl at librato.com
Tue Sep 29 16:34:04 PDT 2009
Queued for ckpt-v18-dev.
Matt Helsley wrote:
> 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);
> }
_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
More information about the Devel
mailing list