On Mon, Mar 23, 2020 at 11:33 AM Vishal Verma <[email protected]> wrote:
>
> Static analysis reported that we were leaking 'fd' in one case in the
> above function, fix the error handling to go through the 'out' label.
>
> Cc: Dan Williams <[email protected]>
> Signed-off-by: Vishal Verma <[email protected]>
> ---
>  ndctl/namespace.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/ndctl/namespace.c b/ndctl/namespace.c
> index 21252b6..0550580 100644
> --- a/ndctl/namespace.c
> +++ b/ndctl/namespace.c
> @@ -1958,8 +1958,10 @@ static int file_write_infoblock(const char *path)
>         }
>
>         buf = calloc(INFOBLOCK_SZ, 1);
> -       if (!buf)
> -               return -ENOMEM;
> +       if (!buf) {
> +               rc = -ENOMEM;
> +               goto out;
> +       }

Looks good:

Reviewed-by: Dan Williams <[email protected]>
_______________________________________________
Linux-nvdimm mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to