* [PATCH] Revert "getnetconfig.c: free linep to avoid memory leakage"
@ 2024-11-14 1:00 Steve Dickson
0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2024-11-14 1:00 UTC (permalink / raw)
To: Linux NFS Mailing list
This reverts commit f138e68e7ffefa3f4d71857ddb137fff877fd1d0.
---
src/getnetconfig.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/getnetconfig.c b/src/getnetconfig.c
index 7888f8c..d547dce 100644
--- a/src/getnetconfig.c
+++ b/src/getnetconfig.c
@@ -503,7 +503,9 @@ getnetconfigent(netid)
break;
}
} while (stringp != NULL);
- free(linep);
+ if (ncp == NULL) {
+ free(linep);
+ }
fclose(file);
return(ncp);
}
--
2.47.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* [PATCH] Revert "getnetconfig.c: free linep to avoid memory leakage"
@ 2024-11-14 15:59 Steve Dickson
0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2024-11-14 15:59 UTC (permalink / raw)
To: Libtirpc-devel Mailing List; +Cc: Linux NFS Mailing list
This reverts commit f138e68e7ffefa3f4d71857ddb137fff877fd1d0.
There was no memory leak and freeing allocated
memory is not a good thing
Signed-off-by: Steve Dickson <steved@redhat.com>
---
src/getnetconfig.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/getnetconfig.c b/src/getnetconfig.c
index 7888f8c..d547dce 100644
--- a/src/getnetconfig.c
+++ b/src/getnetconfig.c
@@ -503,7 +503,9 @@ getnetconfigent(netid)
break;
}
} while (stringp != NULL);
- free(linep);
+ if (ncp == NULL) {
+ free(linep);
+ }
fclose(file);
return(ncp);
}
--
2.47.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-14 15:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-14 1:00 [PATCH] Revert "getnetconfig.c: free linep to avoid memory leakage" Steve Dickson
-- strict thread matches above, loose matches on Subject: below --
2024-11-14 15:59 Steve Dickson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox