From d73f9ec75058b6e7c9a98bfac120108c8d837337 Mon Sep 17 00:00:00 2001 From: "AD005\\z0046beb" Date: Mon, 17 Nov 2025 17:36:57 +0100 Subject: [PATCH] =?UTF-8?q?Verbesserungen=20an=20der=20gro=C3=9Fen=20Funkt?= =?UTF-8?q?ion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- imageInput.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/imageInput.c b/imageInput.c index 0f782b4..cb7b68e 100644 --- a/imageInput.c +++ b/imageInput.c @@ -13,7 +13,7 @@ static int checkDimensions(unsigned int width, unsigned int height){ int ok = 0; - if(width == 10 && height == 10) + if(width > 0 && height > 0) return ok = 1; else @@ -101,6 +101,8 @@ GrayScaleImageSeries *readImages(const char *path) free(series); fclose(fp); return NULL; + + series -> images[i].buffer = malloc(width * height); } for(int i = 0; i < numImages; i++) @@ -109,11 +111,11 @@ GrayScaleImageSeries *readImages(const char *path) series -> images[i].width = width; series -> images[i].height = height; - fread(series -> images[i].buffer, width * height, 1, fp); if(fread(series -> images[i].buffer, width * height, 1, fp) != (width * height)) { clearSeries(series); + fclose(fp); return NULL; }