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 | 258589ad85c1d41ca9401b72ae22b5b8dd460e44 (patch) | |
tree | b55f621abea01399c0c9908f4afc4f39b208fcc9 | |
parent | malloc the deflate buffer in pngo (diff) | |
download | src-258589ad85c1d41ca9401b72ae22b5b8dd460e44.tar.gz src-258589ad85c1d41ca9401b72ae22b5b8dd460e44.zip |
malloc deflate buffer in glitch
Diffstat (limited to '')
-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 bd3d1e48..6a3967f7 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) { |