diff options
author | June McEnroe <june@causal.agency> | 2018-07-16 13:21:56 -0400 |
---|---|---|
committer | June McEnroe <june@causal.agency> | 2018-07-16 13:21:56 -0400 |
commit | 976add5cee793994dbab991a0ea147cbd13a6044 (patch) | |
tree | 7a99ee619bc6217e9b048577ee48fb571af4bc09 | |
parent | malloc the deflate buffer in pngo (diff) | |
download | src-976add5cee793994dbab991a0ea147cbd13a6044.tar.gz src-976add5cee793994dbab991a0ea147cbd13a6044.zip |
malloc deflate buffer in glitch
-rw-r--r-- | bin/glitch.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/glitch.c b/bin/glitch.c index a8c3bfff..3d58fa33 100644 --- a/bin/glitch.c +++ b/bin/glitch.c @@ -239,7 +239,9 @@ static void readData(void) { static void writeData(void) { uLong size = compressBound(dataSize()); - uint8_t deflate[size]; + uint8_t *deflate = malloc(size); + if (!deflate) err(EX_OSERR, "malloc"); + int error = compress2(deflate, &size, data, dataSize(), Z_BEST_SPEED); if (error != Z_OK) errx(EX_SOFTWARE, "%s: compress2: %d", path, error); @@ -247,6 +249,8 @@ static void writeData(void) { writeChunk(idat); writeExpect(deflate, size); writeCrc(); + + free(deflate); } static void writeEnd(void) { |