From 2288e90ba575c764204bd90623a1c3ba596b45ad Mon Sep 17 00:00:00 2001 From: hellkite500 Date: Wed, 12 Jun 2024 20:51:20 -0600 Subject: [PATCH] fix: free instead of delete for malloc'd mem --- src/bmi_lgar.cxx | 4 ++-- src/lgar.cxx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/bmi_lgar.cxx b/src/bmi_lgar.cxx index e1c7e1d..583316f 100644 --- a/src/bmi_lgar.cxx +++ b/src/bmi_lgar.cxx @@ -62,9 +62,9 @@ Initialize (std::string config_file) */ void BmiLGAR::realloc_soil(){ if(state->lgar_bmi_params.soil_depth_wetting_fronts != nullptr) - delete state->lgar_bmi_params.soil_depth_wetting_fronts; + free(state->lgar_bmi_params.soil_depth_wetting_fronts); if(state->lgar_bmi_params.soil_moisture_wetting_fronts != nullptr) - delete state->lgar_bmi_params.soil_moisture_wetting_fronts; + free(state->lgar_bmi_params.soil_moisture_wetting_fronts); state->lgar_bmi_params.soil_depth_wetting_fronts = new double[state->lgar_bmi_params.num_wetting_fronts]; state->lgar_bmi_params.soil_moisture_wetting_fronts = new double[state->lgar_bmi_params.num_wetting_fronts]; diff --git a/src/lgar.cxx b/src/lgar.cxx index 900a3f8..491a8fb 100755 --- a/src/lgar.cxx +++ b/src/lgar.cxx @@ -1138,8 +1138,8 @@ extern void lgar_move_wetting_fronts(double timestep_h, double *volin_cm, int wf delta_thetas, delta_thickness, soil_type, soil_properties); actual_ET_demand = *AET_demand_cm; //done with delta_thetas and delta_thickness, cleanup memory - delete delta_thetas; - delete delta_thickness; + free(delta_thetas); + free(delta_thickness); current->theta = fmax(theta_r, fmin(theta_new, theta_e)); double Se = calc_Se_from_theta(current->theta,theta_e,theta_r);