diff --git a/common/train.cpp b/common/train.cpp index 35a4cf9e6..89d64d7cc 100644 --- a/common/train.cpp +++ b/common/train.cpp @@ -46,6 +46,10 @@ struct random_normal_distribution * init_random_normal_distribution( int seed, float mean, float std, float min, float max ) { struct random_normal_distribution * rnd = (struct random_normal_distribution *) malloc(sizeof(struct random_normal_distribution)); + if( NULL == rnd) { + fprintf(stderr, "could not allocate memory for normal distribution data\n"); + exit(1); + } rnd->gen = std::mt19937(seed); rnd->rd = std::normal_distribution{mean, std}; rnd->min = min;