Re: [PATCH 2/4] ksmbd-tools: Fix memory leak in lsarpc_lookup_names3_invoke

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Looks good to me.
Reviewed-by: Hyunchul Lee <hyc.lee@xxxxxxxxx>

2022년 3월 1일 (화) 오후 10:58, Marios Makassikis <mmakassikis@xxxxxxxxxx>님이 작성:
>
> If usm_lookup_user() fails, the "ni" struct is leaked.
>
> Signed-off-by: Marios Makassikis <mmakassikis@xxxxxxxxxx>
> ---
>  mountd/rpc_lsarpc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/mountd/rpc_lsarpc.c b/mountd/rpc_lsarpc.c
> index cc99a147b239..b9088950c46e 100644
> --- a/mountd/rpc_lsarpc.c
> +++ b/mountd/rpc_lsarpc.c
> @@ -357,8 +357,10 @@ static int lsarpc_lookup_names3_invoke(struct ksmbd_rpc_pipe *pipe)
>                 }
>
>                 ni->user = usm_lookup_user(name);
> -               if (!ni->user)
> +               if (!ni->user) {
> +                       free(ni);
>                         break;
> +               }
>                 pipe->entries = g_array_append_val(pipe->entries, ni);
>                 pipe->num_entries++;
>                 smb_init_domain_sid(&ni->sid);
> --
> 2.25.1
>


-- 
Thanks,
Hyunchul




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux