Skip to content
Snippets Groups Projects
Commit 734729b0 authored by Axel Kohlmeyer's avatar Axel Kohlmeyer
Browse files

avoid small memory leak with USER-REAXC + USER-OMP, spotted by GCC's address sanitizer

parent 69d97fa6
No related branches found
No related tags found
No related merge requests found
...@@ -196,11 +196,10 @@ void DeAllocate_Workspace( control_params *control, storage *workspace ) ...@@ -196,11 +196,10 @@ void DeAllocate_Workspace( control_params *control, storage *workspace )
/* reductions */ /* reductions */
#ifdef LMP_USER_OMP #ifdef LMP_USER_OMP
if(workspace->CdDeltaReduction) sfree( workspace->CdDeltaReduction, "cddelta_reduce" ); if (workspace->CdDeltaReduction) sfree( workspace->CdDeltaReduction, "cddelta_reduce" );
if(workspace->forceReduction) sfree( workspace->forceReduction, "f_reduce" ); if (workspace->forceReduction) sfree( workspace->forceReduction, "f_reduce" );
if(workspace->valence_angle_atom_myoffset) sfree( workspace->valence_angle_atom_myoffset, "valence_angle_atom_myoffset"); if (workspace->valence_angle_atom_myoffset) sfree( workspace->valence_angle_atom_myoffset, "valence_angle_atom_myoffset");
if (workspace->my_ext_pressReduction) sfree( workspace->my_ext_pressReduction, "ext_press_reduce");
if (control->virial && workspace->my_ext_pressReduction) sfree( workspace->my_ext_pressReduction, "ext_press_reduce");
#endif #endif
} }
...@@ -307,9 +306,7 @@ int Allocate_Workspace( reax_system *system, control_params *control, ...@@ -307,9 +306,7 @@ int Allocate_Workspace( reax_system *system, control_params *control,
"forceReduction", comm); "forceReduction", comm);
workspace->valence_angle_atom_myoffset = (int *) scalloc(sizeof(int), total_cap, "valence_angle_atom_myoffset", comm); workspace->valence_angle_atom_myoffset = (int *) scalloc(sizeof(int), total_cap, "valence_angle_atom_myoffset", comm);
workspace->my_ext_pressReduction = (rvec *) calloc(sizeof(rvec), control->nthreads);
if (control->virial)
workspace->my_ext_pressReduction = (rvec *) calloc(sizeof(rvec), control->nthreads);
#endif #endif
return SUCCESS; return SUCCESS;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment