commit 1be01ceab93be27ab87272455118b603568fa0d6
parent dd315b468a69ce2729b2ceb4e4ab8e396867c1bd
Author: Frederic Cambus <fred@statdns.com>
Date: Sun, 15 Jul 2018 20:20:17 +0200
Add error handling for gdImageCreate in the PCBoard loader
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/loaders/pcboard.c b/src/loaders/pcboard.c
@@ -137,6 +137,11 @@ int ansilove_pcboard(struct ansilove_ctx *ctx, struct ansilove_options *options)
// allocate buffer image memory
canvas = gdImageCreate(80 * options->bits, (rowMax)*fontData.height);
+ if (!canvas) {
+ ctx->error = GD_ERROR;
+ return -1;
+ }
+
// allocate black color and create background canvas
gdImageColorAllocate(canvas, 0, 0, 0);
gdImageFill(canvas, 0, 0, 0);