[Pinfo-devel] r55 - pinfo/branches/cxx/src

Nathanael Nerode neroden-guest at costa.debian.org
Sun Aug 28 21:30:30 UTC 2005


Author: neroden-guest
Date: 2005-08-28 21:30:29 +0000 (Sun, 28 Aug 2005)
New Revision: 55

Modified:
   pinfo/branches/cxx/src/filehandling_functions.cxx
Log:
Eliminate memory leak introduced in last commit via more conversion.


Modified: pinfo/branches/cxx/src/filehandling_functions.cxx
===================================================================
--- pinfo/branches/cxx/src/filehandling_functions.cxx	2005-08-28 21:28:30 UTC (rev 54)
+++ pinfo/branches/cxx/src/filehandling_functions.cxx	2005-08-28 21:30:29 UTC (rev 55)
@@ -89,11 +89,10 @@
 }
 
 int
-matchfile(char **buf, char *name)
+matchfile(char **buf, const string name_string)
 {
 #define Buf	(*buf)
 	DIR *dir;
-	string name_string = name;
 	string basename_string;
 	string dirname_string;
 	basename_and_dirname(name_string, basename_string, dirname_string);
@@ -737,9 +736,8 @@
 		else
 		{
 			strcpy(buf, infopaths[i]);	/* build a filename */
-			char* filename_fixme = NULL;
-			filename_fixme = strdup(filename); /* big memory leak */
-			if (matchfile(&buf, filename_fixme) == 1)	/* no match found in this directory */
+			string filename_string = filename;
+			if (matchfile(&buf, filename_string) == 1)	/* no match found in this directory */
 				continue;
 		}
 		bufend = buf;




More information about the Pinfo-devel mailing list