diff options
Diffstat (limited to 'src/H5Osdspace.c')
-rw-r--r-- | src/H5Osdspace.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/H5Osdspace.c b/src/H5Osdspace.c index 63eb122..f6be82b 100644 --- a/src/H5Osdspace.c +++ b/src/H5Osdspace.c @@ -144,10 +144,10 @@ H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p) p += 4; /*reserved*/ - if (sdim->rank > 0) { - if (NULL==(sdim->size=H5FL_ARR_MALLOC(hsize_t,sdim->rank))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - for (i = 0; i < sdim->rank; i++) { + if(sdim->rank > 0) { + if(NULL == (sdim->size = H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + for(i = 0; i < sdim->rank; i++) { H5F_DECODE_LENGTH (f, p, sdim->size[i]); #ifndef H5_HAVE_LARGE_HSIZET /* Rudimentary check for overflow of the dimension size */ @@ -156,10 +156,10 @@ H5O_sdspace_decode(H5F_t *f, hid_t UNUSED dxpl_id, const uint8_t *p) #endif /* H5_HAVE_LARGE_HSIZET */ } /* end for */ - if (flags & H5S_VALID_MAX) { - if (NULL==(sdim->max=H5FL_ARR_MALLOC(hsize_t,sdim->rank))) - HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed"); - for (i = 0; i < sdim->rank; i++) + if(flags & H5S_VALID_MAX) { + if(NULL == (sdim->max = H5FL_ARR_MALLOC(hsize_t, (size_t)sdim->rank))) + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") + for(i = 0; i < sdim->rank; i++) H5F_DECODE_LENGTH (f, p, sdim->max[i]); } } |