From 3d812ce90a659464a99186901eb08f064b7cd21f Mon Sep 17 00:00:00 2001 From: Andrey Alekseenko Date: Mon, 5 Oct 2020 12:03:45 +0200 Subject: [PATCH] Fix logic in init_ewald_coulomb_force_table Previously, destroyParamLookupTable was called only if buffer was nullptr (uninitialized). Which looks like a typo, and leads to nothing, because all implementation of destroyParamLookupTable would refuse to work on nullptr. Changed the check to free the buffer only if there is anything to free. --- src/gromacs/nbnxm/nbnxm_gpu_data_mgmt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gromacs/nbnxm/nbnxm_gpu_data_mgmt.cpp b/src/gromacs/nbnxm/nbnxm_gpu_data_mgmt.cpp index 3fd85ae473..47cfa5b81f 100644 --- a/src/gromacs/nbnxm/nbnxm_gpu_data_mgmt.cpp +++ b/src/gromacs/nbnxm/nbnxm_gpu_data_mgmt.cpp @@ -72,7 +72,7 @@ void init_ewald_coulomb_force_table(const EwaldCorrectionTables& tables, NBParamGpu* nbp, const DeviceContext& deviceContext) { - if (!nbp->coulomb_tab) + if (nbp->coulomb_tab) { destroyParamLookupTable(&nbp->coulomb_tab, nbp->coulomb_tab_texobj); } -- 2.22.0