Minor code cleanup

This commit is contained in:
Isaac Shoebottom 2023-12-04 20:19:20 -04:00
parent a62d97f575
commit 862af7192c
2 changed files with 3 additions and 1 deletions

View File

@ -3,6 +3,7 @@
#include <limits.h>
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
#include "png.h"
int main(int argc, char *argv[]) {

View File

@ -139,7 +139,8 @@ void xor_data(png_chunk *chunk) {
void destroy_chunks(png_chunk **chunks) {
unsigned int size = get_number_of_chunks(chunks);
for (int i = 0; i < size; i++) {
// +1 for IEND chunk
for (int i = 0; i < size + 1; i++) {
free(chunks[i]->data);
free(chunks[i]);
}