diff mbox series

Revert "getnetconfig.c: free linep to avoid memory leakage"

Message ID 20241114155904.591057-1-steved@redhat.com (mailing list archive)
State New
Headers show
Series Revert "getnetconfig.c: free linep to avoid memory leakage" | expand

Commit Message

Steve Dickson Nov. 14, 2024, 3:59 p.m. UTC
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 mbox series

Patch

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);
 }