Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
char* to string == free--
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 20 Jul 2017 07:41:18 +0000 (09:41 +0200)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Thu, 20 Jul 2017 07:41:18 +0000 (09:41 +0200)
src/surf/surf_interface.cpp

index cf5f486..cc313a1 100644 (file)
@@ -161,9 +161,8 @@ FILE *surf_fopen(const char *name, const char *mode)
 
   /* search relative files in the path */
   for (auto path_elm : surf_path) {
-    char* buff = bprintf("%s" FILE_DELIM "%s", path_elm.c_str(), name);
-    file = fopen(buff, mode);
-    free(buff);
+    std::string buff = path_elm + FILE_DELIM + name;
+    file             = fopen(buff.c_str(), mode);
 
     if (file)
       return file;