diff --git a/src/configuration_space_deserialize.h b/src/configuration_space_deserialize.h index 882e23f0..6911de66 100644 --- a/src/configuration_space_deserialize.h +++ b/src/configuration_space_deserialize.h @@ -52,10 +52,10 @@ _ccs_deserialize_bin_ccs_configuration_space_data( data->num_forbidden_clauses)) return CCS_RESULT_SUCCESS; mem = (uintptr_t)calloc( + 1, data->num_parameters * sizeof(ccs_parameter_t) + data->num_parameters * sizeof(ccs_expression_t) + - data->num_forbidden_clauses * sizeof(ccs_expression_t), - 1); + data->num_forbidden_clauses * sizeof(ccs_expression_t)); CCS_REFUTE(!mem, CCS_RESULT_ERROR_OUT_OF_MEMORY); data->parameters = (ccs_parameter_t *)mem; diff --git a/src/distribution_space_deserialize.h b/src/distribution_space_deserialize.h index 290b4e51..8b176518 100644 --- a/src/distribution_space_deserialize.h +++ b/src/distribution_space_deserialize.h @@ -35,10 +35,9 @@ _ccs_deserialize_bin_ccs_distribution_space_data( if (!(data->num_distributions)) return CCS_RESULT_SUCCESS; mem = (uintptr_t)calloc( - data->num_distributions * - (sizeof(ccs_distribution_t) + sizeof(size_t)) + - data->num_parameters * sizeof(size_t), - 1); + 1, data->num_distributions * (sizeof(ccs_distribution_t) + + sizeof(size_t)) + + data->num_parameters * sizeof(size_t)); CCS_REFUTE(!mem, CCS_RESULT_ERROR_OUT_OF_MEMORY); data->distributions = (ccs_distribution_t *)mem; diff --git a/src/objective_space_deserialize.h b/src/objective_space_deserialize.h index bba9c935..85ab07a9 100644 --- a/src/objective_space_deserialize.h +++ b/src/objective_space_deserialize.h @@ -44,10 +44,10 @@ _ccs_deserialize_bin_ccs_objective_space_data( if (!(data->num_parameters + data->num_objectives)) return CCS_RESULT_SUCCESS; mem = (uintptr_t)calloc( + 1, data->num_parameters * sizeof(ccs_parameter_t) + data->num_objectives * (sizeof(ccs_expression_t) + - sizeof(ccs_objective_type_t)), - 1); + sizeof(ccs_objective_type_t))); CCS_REFUTE(!mem, CCS_RESULT_ERROR_OUT_OF_MEMORY); data->parameters = (ccs_parameter_t *)mem; mem += data->num_parameters * sizeof(ccs_parameter_t); diff --git a/src/tuner_deserialize.h b/src/tuner_deserialize.h index 78bd7452..7c455dda 100644 --- a/src/tuner_deserialize.h +++ b/src/tuner_deserialize.h @@ -50,7 +50,7 @@ _ccs_deserialize_bin_ccs_random_tuner_data( if (!(data->history_size + data->size_optima)) return CCS_RESULT_SUCCESS; mem = (uintptr_t)calloc( - (data->history_size + data->size_optima), + data->history_size + data->size_optima, sizeof(ccs_evaluation_t)); CCS_REFUTE(!mem, CCS_RESULT_ERROR_OUT_OF_MEMORY); diff --git a/src/tuner_user_defined.c b/src/tuner_user_defined.c index 9fbb9201..17186c52 100644 --- a/src/tuner_user_defined.c +++ b/src/tuner_user_defined.c @@ -49,7 +49,7 @@ _ccs_serialize_bin_size_ccs_user_defined_tuner( *cum_size += _ccs_serialize_bin_size_size(num_optima); if (0 != history_size + num_optima) { history = (ccs_evaluation_t *)calloc( - sizeof(ccs_evaluation_t), history_size + num_optima); + history_size + num_optima, sizeof(ccs_evaluation_t)); CCS_REFUTE(!history, CCS_RESULT_ERROR_OUT_OF_MEMORY); optima = history + history_size; if (history_size) { @@ -119,7 +119,7 @@ _ccs_serialize_bin_ccs_user_defined_tuner( CCS_VALIDATE(_ccs_serialize_bin_size(num_optima, buffer_size, buffer)); if (0 != history_size + num_optima) { history = (ccs_evaluation_t *)calloc( - sizeof(ccs_evaluation_t), history_size + num_optima); + history_size + num_optima, sizeof(ccs_evaluation_t)); CCS_REFUTE(!history, CCS_RESULT_ERROR_OUT_OF_MEMORY); optima = history + history_size; if (history_size) {