summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-07-16 13:21:56 -0400
committerJune McEnroe <june@causal.agency>2018-07-16 13:21:56 -0400
commit976add5cee793994dbab991a0ea147cbd13a6044 (patch)
tree7a99ee619bc6217e9b048577ee48fb571af4bc09
parentmalloc the deflate buffer in pngo (diff)
downloadsrc-976add5cee793994dbab991a0ea147cbd13a6044.tar.gz
src-976add5cee793994dbab991a0ea147cbd13a6044.zip
malloc deflate buffer in glitch
Diffstat (limited to '')
-rw-r--r--bin/glitch.c6
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) {