diff mbox series

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

Message ID 20241114010011.544247-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, 1 a.m. UTC
This reverts commit f138e68e7ffefa3f4d71857ddb137fff877fd1d0.
---
 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);
 }