]> git.donarmstrong.com Git - mothur.git/blobdiff - readdistcommand.cpp
added help for alignment code and thomas' calcs to project
[mothur.git] / readdistcommand.cpp
index d8c3db1c896b53c2f0d270a5c2d4df1ac9eed626..8de0c34ee039e3c79d539fb7ed531fb2351f3400 100644 (file)
@@ -8,6 +8,9 @@
  */
 
 #include "readdistcommand.h"
+#include "readphylip.h"
+#include "readcolumn.h"
+#include "readmatrix.hpp"
 
 ReadDistCommand::ReadDistCommand(){
        try {
@@ -75,7 +78,10 @@ int ReadDistCommand::execute(){
                        globaldata->gMatrix = matrix; //save matrix for coverage commands
                }else {
                        read->read(nameMap);
+                       //to prevent memory leak
+                       if (globaldata->gListVector != NULL) { delete globaldata->gListVector;  }
                        globaldata->gListVector = read->getListVector();
+                       if (globaldata->gSparseMatrix != NULL) { delete globaldata->gSparseMatrix;  }
                        globaldata->gSparseMatrix = read->getMatrix();
                }
                return 0;