commit e8a4e45f0569384481071ab09038141ef5d8d748
parent 2c1e1c1082162af7ef875e07b81b79474f273760
Author: Brian Cassidy <brian.cassidy@unb.ca>
Date: Mon, 25 Apr 2022 16:23:57 -0300
fix xbin font memory leaks
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/loaders/xbin.c b/src/loaders/xbin.c
@@ -142,6 +142,7 @@ ansilove_xbin(struct ansilove_ctx *ctx, struct ansilove_options *options)
if (xbin_flags & 0x10) {
if (offset + fontsz > ctx->length) {
ctx->error = ANSILOVE_FORMAT_ERROR;
+ free(font_data_xbin);
return -1;
}
@@ -149,6 +150,7 @@ ansilove_xbin(struct ansilove_ctx *ctx, struct ansilove_options *options)
high_font_data_xbin = (uint8_t *)malloc(fontsz);
if (high_font_data_xbin == NULL) {
ctx->error = ANSILOVE_MEMORY_ERROR;
+ free(font_data_xbin);
return -1;
}
@@ -183,6 +185,7 @@ ansilove_xbin(struct ansilove_ctx *ctx, struct ansilove_options *options)
} else {
ctx->error = ANSILOVE_FORMAT_ERROR;
free(font_data_xbin);
+ free(high_font_data_xbin);
return -1;
}
}