From 973cf017a960c0a6a622192ae8a18682c7b684de Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 24 Sep 2021 15:32:59 -0400 Subject: [PATCH] do not call memset on a null pointer --- src/read_data.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/read_data.cpp b/src/read_data.cpp index c33c65f676..574117e93e 100644 --- a/src/read_data.cpp +++ b/src/read_data.cpp @@ -1321,7 +1321,7 @@ void ReadData::bonds(int firstpass) int *count = nullptr; if (firstpass) { memory->create(count,nlocal,"read_data:count"); - memset(count,0,nlocal*sizeof(int)); + if (count) memset(count,0,nlocal*sizeof(int)); } // read and process bonds @@ -1395,7 +1395,7 @@ void ReadData::angles(int firstpass) int *count = nullptr; if (firstpass) { memory->create(count,nlocal,"read_data:count"); - memset(count,0,nlocal*sizeof(int)); + if (count) memset(count,0,nlocal*sizeof(int)); } // read and process angles @@ -1469,7 +1469,7 @@ void ReadData::dihedrals(int firstpass) int *count = nullptr; if (firstpass) { memory->create(count,nlocal,"read_data:count"); - memset(count,0,nlocal*sizeof(int)); + if (count) memset(count,0,nlocal*sizeof(int)); } // read and process dihedrals @@ -1543,7 +1543,7 @@ void ReadData::impropers(int firstpass) int *count = nullptr; if (firstpass) { memory->create(count,nlocal,"read_data:count"); - memset(count,0,nlocal*sizeof(int)); + if (count) memset(count,0,nlocal*sizeof(int)); } // read and process impropers