[dm-devel] [PATCH] libmultipath: fix memory leak in checker_cleanup_thread
Martin Wilck
mwilck at suse.com
Mon Apr 12 08:05:14 UTC 2021
On Fri, 2021-04-09 at 09:59 -0500, Benjamin Marzinski wrote:
> On Fri, Apr 09, 2021 at 03:15:05PM +0800, lixiaokeng wrote:
> > If checker_cleanup_thread is called after cleanup_checkers,
> > the checker_class will not be freed.
> >
> > Here, we use free_checker_class instead of checker_class_unref
> > in checker_cleanup_thread.
> >
> > Signed-off-by: Lixiaokeng <lixiaokeng at huawei.com>
> > ---
> > libmultipath/checkers.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libmultipath/checkers.c b/libmultipath/checkers.c
> > index 2dd9915d..7cc80f0b 100644
> > --- a/libmultipath/checkers.c
> > +++ b/libmultipath/checkers.c
> > @@ -368,7 +368,7 @@ static void checker_cleanup_thread(void *arg)
> > {
> > struct checker_class *cls = arg;
> >
> > - (void)checker_class_unref(cls);
> > + (void)free_checker_class(cls);
> > rcu_unregister_thread();
> > }
> >
> > --
>
> Reviewed-by: Benjamin Marzinski <bmarzins at redhat.com>
>
Nit: The cast to void is wrong, as free_checker_class() is a void
function anyway. I'll take the freedom to remove it when I apply this
to the "queue" branch.
Thanks,
Martin
Reviewed-by: Martin Wilck <mwilck at suse.com>
More information about the dm-devel
mailing list