2022-10-20 06:39:13

by Zhi Li

[permalink] [raw]
Subject: [PATCH] [nfs/nfs-utils/libtirpc] bindresvport.c: fix a potential resource leakage

Close the FILE *fp of load_blacklist() in another
return path to avoid potential resource leakage.

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=2135405
Signed-off-by: Zhi Li <[email protected]>
---
src/bindresvport.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/src/bindresvport.c b/src/bindresvport.c
index 5c0ddcf..efeb1cc 100644
--- a/src/bindresvport.c
+++ b/src/bindresvport.c
@@ -130,6 +130,7 @@ load_blacklist (void)
if (list == NULL)
{
free (buf);
+ fclose (fp);
return;
}
}
--
2.31.1


2022-10-24 19:31:16

by Steve Dickson

[permalink] [raw]
Subject: Re: [PATCH] [nfs/nfs-utils/libtirpc] bindresvport.c: fix a potential resource leakage



On 10/20/22 2:33 AM, Zhi Li wrote:
> Subject:
> [PATCH] [nfs/nfs-utils/libtirpc] bindresvport.c: fix a potential
> resource leakage
> From:
> Zhi Li <[email protected]>
> Date:
> 10/20/22, 2:33 AM
>
> To:
> [email protected]
> CC:
> [email protected], Zhi Li <[email protected]>
>
>
> Close the FILE *fp of load_blacklist() in another
> return path to avoid potential resource leakage.
>
> Fixes:https://bugzilla.redhat.com/show_bug.cgi?id=2135405
> Signed-off-by: Zhi Li<[email protected]>
Committed...

steved.
> ---
> src/bindresvport.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/src/bindresvport.c b/src/bindresvport.c
> index 5c0ddcf..efeb1cc 100644
> --- a/src/bindresvport.c
> +++ b/src/bindresvport.c
> @@ -130,6 +130,7 @@ load_blacklist (void)
> if (list == NULL)
> {
> free (buf);
> + fclose (fp);
> return;
> }
> }
> -- 2.31.1
>