diff mbox series

[nfs/nfs-utils/libtirpc] getnetconfig.c: free linep to avoid memory leakage

Message ID 20230201105725.3500063-1-yieli@redhat.com (mailing list archive)
State New, archived
Headers show
Series [nfs/nfs-utils/libtirpc] getnetconfig.c: free linep to avoid memory leakage | expand

Commit Message

Zhi Li Feb. 1, 2023, 10:57 a.m. UTC
Signed-off-by: Zhi Li <yieli@redhat.com>
---
 src/getnetconfig.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Steve Dickson Nov. 11, 2024, 5:33 p.m. UTC | #1
On 2/1/23 4:57 AM, Zhi Li wrote:
> Signed-off-by: Zhi Li<yieli@redhat.com>
Committed... (tag: libtirpc-1-3-7-rc1)

steved.

> ---
>   src/getnetconfig.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/src/getnetconfig.c b/src/getnetconfig.c
> index 9acd8c7..afbf8b5 100644
> --- a/src/getnetconfig.c
> +++ b/src/getnetconfig.c
> @@ -507,9 +507,7 @@ getnetconfigent(netid)
>   	    break;
>   	}
>       } while (stringp != NULL);
> -    if (ncp == NULL) {
> -	free(linep);
> -    }
> +    free(linep);
>       fclose(file);
>       return(ncp);
>   }
> -- 2.39.0
>
diff mbox series

Patch

diff --git a/src/getnetconfig.c b/src/getnetconfig.c
index 9acd8c7..afbf8b5 100644
--- a/src/getnetconfig.c
+++ b/src/getnetconfig.c
@@ -507,9 +507,7 @@  getnetconfigent(netid)
 	    break;
 	}
     } while (stringp != NULL);
-    if (ncp == NULL) {
-	free(linep);
-    }
+    free(linep);
     fclose(file);
     return(ncp);
 }