summaryrefslogtreecommitdiffstats
path: root/hl/tools/gif2h5/decompress.c
diff options
context:
space:
mode:
authorDana Robinson <derobins@hdfgroup.org>2020-01-30 02:09:29 (GMT)
committerDana Robinson <derobins@hdfgroup.org>2020-01-30 02:09:29 (GMT)
commita67c238feef1487814b02132bfd7961f22d9d6eb (patch)
tree07d613f8cd85a72f49acada0922004227a5c12b9 /hl/tools/gif2h5/decompress.c
parent9475ee5d59e9ac916271a64c5372dfc28f709417 (diff)
downloadhdf5-a67c238feef1487814b02132bfd7961f22d9d6eb.zip
hdf5-a67c238feef1487814b02132bfd7961f22d9d6eb.tar.gz
hdf5-a67c238feef1487814b02132bfd7961f22d9d6eb.tar.bz2
Cleaned up remaining warnings in high-level library.
Diffstat (limited to 'hl/tools/gif2h5/decompress.c')
-rw-r--r--hl/tools/gif2h5/decompress.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/hl/tools/gif2h5/decompress.c b/hl/tools/gif2h5/decompress.c
index 8cd8a8e..129fa60 100644
--- a/hl/tools/gif2h5/decompress.c
+++ b/hl/tools/gif2h5/decompress.c
@@ -57,12 +57,12 @@ GIFBYTE *Raster; /* The raster data stream, unblocked *
/* The hash table used by the decompressor */
-int Prefix[4096];
-int Suffix[4096];
+int *Prefix;
+int *Suffix;
/* An output array used by the decompressor */
-int OutCode[1025];
+int *OutCode;
/* The color map, read from the GIF header */
@@ -159,6 +159,19 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
{
int i;
+ if (!(Prefix = calloc(4096, sizeof(int)))) {
+ printf("Out of memory");
+ exit(EXIT_FAILURE);
+ }
+ if (!(Suffix = calloc(4096, sizeof(int)))) {
+ printf("Out of memory");
+ exit(EXIT_FAILURE);
+ }
+ if (!(OutCode = calloc(1024, sizeof(int)))) {
+ printf("Out of memory");
+ exit(EXIT_FAILURE);
+ }
+
XC = 0;
YC = 0;
Pass = 0;
@@ -309,5 +322,9 @@ Decompress(GIFIMAGEDESC *GifImageDesc, GIFHEAD *GifHead)
Code = ReadCode();
}
+ free(Prefix);
+ free(Suffix);
+ free(OutCode);
+
return Image;
}