diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp
index ccd6f261b70d1fab8cdc688364801dad6f347b7b..f0f98f5bf6493c69c0c73bec519d66d2b5c8aec0 100644
--- a/indra/llcommon/llsys.cpp
+++ b/indra/llcommon/llsys.cpp
@@ -853,17 +853,14 @@ void LLMemoryInfo::stream(std::ostream& s) const
         s << pfx << "Total Physical KB:  " << phys << std::endl;
 
 #elif LL_LINUX
-	LLFILE* meminfo = LLFile::fopen(MEMINFO_FILE,"rb");
-	if(meminfo)
+	std::ifstream meminfo(MEMINFO_FILE);
+	if (meminfo.is_open())
 	{
-		char line[MAX_STRING];		/* Flawfinder: ignore */
-		memset(line, 0, sizeof(line));
-		while(fgets(line, sizeof(line), meminfo))
+		std::string line;
+		while (std::getline(meminfo, line))
 		{
-			line[strlen(line)-1] = ' ';		 /*Flawfinder: ignore*/
-			s << pfx << line;
+			s << pfx << line << '\n';
 		}
-		fclose(meminfo);
 	}
 	else
 	{