]> git.donarmstrong.com Git - mothur.git/blobdiff - readdistcommand.cpp
documentation
[mothur.git] / readdistcommand.cpp
index a9d772183d253168e96d48aa6d979c94616bde0d..9db835a2fb5ffe492b145e64213191fa8d901baa 100644 (file)
@@ -21,6 +21,7 @@ ReadDistCommand::ReadDistCommand(){
                else if (format == "matrix") { 
                                groupMap = new GroupMap(globaldata->getGroupFile());
                                groupMap->readMap();
+                               if (globaldata->gGroupmap != NULL) { delete globaldata->gGroupmap;  }
                                globaldata->gGroupmap = groupMap;
                }
                
@@ -69,6 +70,8 @@ int ReadDistCommand::execute(){
                        ifstream in;
                        openInputFile(filename, in);
                        matrix = new FullMatrix(in); //reads the matrix file
+                       //memory leak prevention
+                       if (globaldata->gMatrix != NULL) { delete globaldata->gMatrix;  }
                        globaldata->gMatrix = matrix; //save matrix for coverage commands
                }else {
                        read->read(nameMap);