Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Leak --
authorPierre Veyre <pierre.veyre@cc.in2p3.fr>
Fri, 21 Mar 2014 08:43:29 +0000 (09:43 +0100)
committerPierre Veyre <pierre.veyre@cc.in2p3.fr>
Fri, 21 Mar 2014 08:43:29 +0000 (09:43 +0100)
src/surf/storage_interface.hpp
src/surf/storage_n11.cpp
src/surf/storage_n11.hpp
src/surf/workstation_interface.cpp

index 5b89f8d..7e17d8e 100644 (file)
@@ -182,7 +182,7 @@ public:
    * 
    * @return The StorageAction corresponding to the opening
    */
-  virtual StorageActionPtr open(const char* mount, char* path)=0;
+  virtual StorageActionPtr open(char* mount, char* path)=0;
 
   /**
    * @brief Close a file
index 2856220..289e657 100644 (file)
@@ -406,7 +406,7 @@ StorageActionPtr StorageN11::ls(const char* path)
   return action;
 }
 
-StorageActionPtr StorageN11::open(const char* mount, char* path)
+StorageActionPtr StorageN11::open(char* mount, char* path)
 {
   XBT_DEBUG("\tOpen file '%s'",path);
 
@@ -431,6 +431,8 @@ StorageActionPtr StorageN11::open(const char* mount, char* path)
   StorageActionPtr action = new StorageN11Action(getModel(), 0, getState() != SURF_RESOURCE_ON, this, OPEN);
   action->p_file = file;
   free(path);
+  free(mount);
+
   return action;
 }
 
index f682ea5..86139cc 100644 (file)
@@ -53,7 +53,7 @@ public:
                     lmm_system_t maxminSystem, double bread, double bwrite, double bconnection,
                     const char* type_id, char *content_name, char *content_type, sg_size_t size, char *attach);
 
-  StorageActionPtr open(const char* mount, char* path);
+  StorageActionPtr open(char* mount, char* path);
   StorageActionPtr close(surf_file_t fd);
   StorageActionPtr ls(const char *path);
   StorageActionPtr read(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param ptr ??
index 8ff047a..c7798bd 100644 (file)
@@ -222,9 +222,10 @@ ActionPtr Workstation::open(const char* fullpath) {
     if(!strcmp(file_mount_name,mnt.name) && strlen(mnt.name)>pos)
     {/* The current mount name is found in the full path and is bigger than the previous*/
       pos = strlen(mnt.name);
-      mount_name = mnt.name;
+      mount_name = strdup(mnt.name);
       st = static_cast<StoragePtr>(mnt.storage);
     }
+    free(file_mount_name);
   }
   if(pos>0)
   { /* Mount point found, deduce path + file name from full path (full path = mount name + path + file name)*/
@@ -235,7 +236,6 @@ ActionPtr Workstation::open(const char* fullpath) {
   else
     xbt_die("Can't find mount point for '%s' on '%s'", fullpath, getName());
 
-  free(file_mount_name);
   return st->open(mount_name, path);
 }