diff options
Diffstat (limited to 'hl/tools/gif2h5/h52gifgentst.c')
-rw-r--r-- | hl/tools/gif2h5/h52gifgentst.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/hl/tools/gif2h5/h52gifgentst.c b/hl/tools/gif2h5/h52gifgentst.c index b1efabf..655563c 100644 --- a/hl/tools/gif2h5/h52gifgentst.c +++ b/hl/tools/gif2h5/h52gifgentst.c @@ -11,6 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ +#include <assert.h> #include <stdio.h> #include <stdlib.h> #include "hdf5.h" @@ -47,12 +48,15 @@ int main(void) { hid_t fid; int i, j, n, space; - unsigned char buf [ WIDTH*HEIGHT ]; + unsigned char *buf; unsigned char pal[ PAL_ENTRIES * 3 ]; /* palette array */ hsize_t pal_dims[2] = {PAL_ENTRIES,3}; /* palette dimensions */ hsize_t width = WIDTH; hsize_t height = HEIGHT; + /* Allocate buffer */ + if(NULL == (buf = (unsigned char *)malloc(WIDTH * HEIGHT))) + return EXIT_FAILURE; /* create a file */ if ((fid = H5Fcreate(FILENAME, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT))<0) @@ -97,6 +101,8 @@ int main(void) if(H5Fclose(fid)<0) return EXIT_FAILURE; + free(buf); + return EXIT_SUCCESS; } |