aboutsummaryrefslogtreecommitdiff
path: root/src/mathfunc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mathfunc.cpp')
-rw-r--r--src/mathfunc.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/mathfunc.cpp b/src/mathfunc.cpp
index 644b3e8..2cce43f 100644
--- a/src/mathfunc.cpp
+++ b/src/mathfunc.cpp
@@ -264,8 +264,12 @@ bool isMatrixPositiveDefinite(const gsl_matrix *G) {
auto s = gsl_linalg_cholesky_decomp(G2);
#endif
gsl_set_error_handler(handler);
- gsl_matrix_safe_free(G2);
- return (s == GSL_SUCCESS);
+ if (s == GSL_SUCCESS) {
+ gsl_matrix_safe_free(G2);
+ return true;
+ }
+ gsl_matrix_free(G2);
+ return (false);
}
gsl_vector *getEigenValues(const gsl_matrix *G) {