]> git.donarmstrong.com Git - mothur.git/blobdiff - readdistcommand.cpp
fixed bug with getting sharedrabunds for venn, heatmap and tree.shared commands,...
[mothur.git] / readdistcommand.cpp
index f19bf115d9e5f7d084b6007f1d738bcf0d33d494..8de0c34ee039e3c79d539fb7ed531fb2351f3400 100644 (file)
@@ -10,6 +10,7 @@
 #include "readdistcommand.h"
 #include "readphylip.h"
 #include "readcolumn.h"
+#include "readmatrix.hpp"
 
 ReadDistCommand::ReadDistCommand(){
        try {
@@ -77,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;