]> 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 0e45ad51f3ebac61c74542076501e775a20498cd..8de0c34ee039e3c79d539fb7ed531fb2351f3400 100644 (file)
@@ -78,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;