summary refs log tree commit diff
path: root/bin/glitch.c
diff options
context:
space:
mode:
Diffstat (limited to 'bin/glitch.c')
-rw-r--r--bin/glitch.c6
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) {