Skip to content

Commit

Permalink
fixed memory leak for omega mode
Browse files Browse the repository at this point in the history
  • Loading branch information
cpockrandt committed Mar 3, 2021
1 parent 6354019 commit fdeb6a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ link_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/libBigWig)

if (PHYLOCSFPP_STATIC_BUILD)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
message("${CMAKE_FIND_LIBRARY_PREFIXES}")
message("${CMAKE_FIND_LIBRARY_SUFFIXES}")
add_definitions (-DPHYLOCSFPP_STATIC_BUILD=1)
# find_library(Var BigWig)
# find_library(Var z)
Expand Down
4 changes: 4 additions & 0 deletions src/instance.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -641,6 +641,8 @@ void PhyloModel_make(instance_t & instance, gsl_vector * prior, const bool insta
{
if (fabs(cell_value) > q.tol) // fabs is for doubles, fabsf is for floats
{
gsl_vector_free(expLt);
gsl_matrix_free(diagm_c);
throw std::runtime_error("CamlPaml.Q.substition_matrix: expm(" + std::to_string(t) + "*Q)[" + std::to_string(index_i) + "," + std::to_string(index_j) + "] = " + std::to_string(cell_value) + " < 0");
}
else
Expand All @@ -656,6 +658,8 @@ void PhyloModel_make(instance_t & instance, gsl_vector * prior, const bool insta

if (fabs(total - 1.0) > q.tol)
{
gsl_vector_free(expLt);
gsl_matrix_free(diagm_c);
throw std::runtime_error("CamlPaml.Q.substition_matrix: sum(expm(" + std::to_string(t) + "*Q)[" + std::to_string(index_i) + ",] = " + std::to_string(total) + " > 1");
}
assert(smii <= 1.0 && smii > 0.0);
Expand Down

0 comments on commit fdeb6a7

Please sign in to comment.