[Rivet-svn] r2626 - trunk/src/Tools

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Fri Jul 30 09:57:39 BST 2010


Author: dgrell
Date: Fri Jul 30 09:57:39 2010
New Revision: 2626

Log:
binreloc memleak fixed

Modified:
   trunk/src/Tools/RivetPaths.cc
   trunk/src/Tools/binreloc.c

Modified: trunk/src/Tools/RivetPaths.cc
==============================================================================
--- trunk/src/Tools/RivetPaths.cc	Fri Jul 30 09:56:56 2010	(r2625)
+++ trunk/src/Tools/RivetPaths.cc	Fri Jul 30 09:57:39 2010	(r2626)
@@ -10,14 +10,18 @@
   const string getLibPath() {
     BrInitError error;
     br_init_lib(&error);
-    const string libdir = br_find_lib_dir(DEFAULTLIBDIR);
+    char* temp = br_find_lib_dir(DEFAULTLIBDIR);
+    const string libdir(temp);
+    free (temp);
     return libdir;
   }
 
   const string getDataPath() {
     BrInitError error;
     br_init_lib(&error);
-    const string sharedir = br_find_data_dir(DEFAULTDATADIR);
+    char* temp = br_find_data_dir(DEFAULTDATADIR);
+    const string sharedir(temp);
+    free (temp);
     return sharedir;
   }
 

Modified: trunk/src/Tools/binreloc.c
==============================================================================
--- trunk/src/Tools/binreloc.c	Fri Jul 30 09:56:56 2010	(r2625)
+++ trunk/src/Tools/binreloc.c	Fri Jul 30 09:57:39 2010	(r2626)
@@ -161,8 +161,9 @@
 			*error = BR_INIT_ERROR_INVALID_MAPS;
 		return NULL;
 	}
-
-	path = strdup (path);
+	char * oldpath = path;
+	path = strdup (oldpath);
+	free (oldpath);
 	free (line);
 	fclose (f);
 	return path;


More information about the Rivet-svn mailing list