From 21f7dd24a1a33e2a2f5c374d7ca3596f782445e3 Mon Sep 17 00:00:00 2001 From: tradke Date: Wed, 21 Aug 2002 11:11:30 +0000 Subject: Check for memory allocation errors. git-svn-id: http://svn.cactuscode.org/arrangements/CactusPUGHIO/IOHDF5/trunk@148 4825ed28-b72c-4eae-9704-e50c059e567d --- src/util/hdf5_convert_from_ieeeio.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util/hdf5_convert_from_ieeeio.c b/src/util/hdf5_convert_from_ieeeio.c index e38b969..f712c38 100644 --- a/src/util/hdf5_convert_from_ieeeio.c +++ b/src/util/hdf5_convert_from_ieeeio.c @@ -160,6 +160,12 @@ int main (int argc, char **argv) assert (dataset >= 0); data = malloc (IOnBytes (ieeeDatatype, rank, dims)); + if (data == NULL) + { + fprintf (stderr, "Could not allocate %d bytes to read in dataset\n", + IOnBytes (ieeeDatatype, rank, dims)); + return (-1); + } IOread (infile, data); assert (H5Dwrite (dataset, hdf5Datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data) >= 0); -- cgit v1.2.3