aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPjotr Prins2021-01-11 08:56:22 +0000
committerPjotr Prins2021-01-11 08:56:22 +0000
commit2e1f48ba900e97e906d18d8c5568b31dfbde3412 (patch)
treefbb6882fd99b5e418c2adfe8ac5a2c1a848949b9
parent47221d6e9891bf9b20ce6e1e909856ccb0ae575f (diff)
downloadpangemma-2e1f48ba900e97e906d18d8c5568b31dfbde3412.tar.gz
Only free randomizer when initialized
Fixes: #239
-rw-r--r--src/param.cpp3
-rw-r--r--src/param.h2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/param.cpp b/src/param.cpp
index c5f60c6..f96e9c3 100644
--- a/src/param.cpp
+++ b/src/param.cpp
@@ -107,7 +107,8 @@ PARAM::PARAM(void)
time_UtZ(0.0), time_opt(0.0), time_Omega(0.0) {}
PARAM::~PARAM() {
- gsl_rng_free(gsl_r);
+ if (gsl_r)
+ gsl_rng_free(gsl_r);
}
// Read files: obtain ns_total, ng_total, ns_test, ni_test.
diff --git a/src/param.h b/src/param.h
index eb2cef7..e747182 100644
--- a/src/param.h
+++ b/src/param.h
@@ -213,7 +213,7 @@ public:
size_t n_mh; // # MH steps in each iter.
double geo_mean; // Mean of geometric dist.
long int randseed; // holds -seed parameter
- gsl_rng *gsl_r; // Track the randomizer
+ gsl_rng *gsl_r = NULL; // Track the randomizer
double trace_G;
HYPBSLMM cHyp_initial;