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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This reverts commit f138e68e7ffefa3f4d71857ddb137fff877fd1d0.

There was no memory leak and freeing allocated
memory is not a good thing

Signed-off-by: Steve Dickson <steved@xxxxxxxxxx>
---
 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





[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux