[dm-devel] [PATCH] multipathd: fix memory leak in reconfigure()

Christophe Varoqui christophe.varoqui at opensvc.com
Fri Jul 22 09:40:04 UTC 2016


Merged.
Thanks.

On Mon, Jul 18, 2016 at 2:14 PM, <tang.junhui at zte.com.cn> wrote:

> From: "tang.junhui" <tang.junhui at zte.com.cn>
>
> Problem:
> Memory leak exists in reconfigure() when multipathd command reconfigure is
> executed.
>
> Reasons:
>  * The following judgment condition is not satisfied when there is no path,
>    free_pathvec() is not called to free the vector of vecs->pathvec:
>        if (VECTOR_SIZE(vecs->pathvec))
>            free_pathvec(vecs->pathvec, FREE_PATHS);
>  * Then the vecs->pathvec is set to NULL, so the vector memory which
>    vecs->pathvec pointed to is leaked:
>        vecs->pathvec = NULL;
>
> Signed-off-by: tang.junhui <tang.junhui at zte.com.cn>
> ---
>  multipathd/main.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/multipathd/main.c b/multipathd/main.c
> index c129298..d9731cd 100644
> --- a/multipathd/main.c
> +++ b/multipathd/main.c
> @@ -1997,9 +1997,7 @@ reconfigure (struct vectors * vecs)
>         if (VECTOR_SIZE(vecs->mpvec))
>                 remove_maps_and_stop_waiters(vecs);
>
> -       if (VECTOR_SIZE(vecs->pathvec))
> -               free_pathvec(vecs->pathvec, FREE_PATHS);
> -
> +       free_pathvec(vecs->pathvec, FREE_PATHS);
>         vecs->pathvec = NULL;
>
>         /* Re-read any timezone changes */
> --
> 2.8.1.windows.1
>
> --------------------------------------------------------
> ZTE Information Security Notice: The information contained in this mail
> (and any attachment transmitted herewith) is privileged and confidential
> and is intended for the exclusive use of the addressee(s).  If you are not
> an intended recipient, any disclosure, reproduction, distribution or other
> dissemination or use of the information contained is strictly prohibited.
> If you have received this mail in error, please delete it and notify us
> immediately.
>
> --
> dm-devel mailing list
> dm-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/dm-devel/attachments/20160722/52edbd5d/attachment.htm>


More information about the dm-devel mailing list