libansilove

Library for converting ANSI, ASCII, and other formats to PNG
Log | Files | Refs | README | LICENSE

commit 05aaab5d8b5ed09cbfd6444fa288ee2ad6d9e879
parent 83521bebd4b0ee72812e47bea7c25297c0006d59
Author: Frederic Cambus <fred@statdns.com>
Date:   Wed, 31 Oct 2018 21:38:30 +0100

Free the IDF buffer on error paths

Diffstat:
Msrc/loaders/icedraw.c | 5++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/loaders/icedraw.c b/src/loaders/icedraw.c @@ -102,6 +102,7 @@ int ansilove_icedraw(struct ansilove_ctx *ctx, struct ansilove_options *options) // error output if (!canvas) { ctx->error = ANSILOVE_GD_ERROR; + free(idf_buffer); return -1; } gdImageColorAllocate(canvas, 0, 0, 0); @@ -136,8 +137,10 @@ int ansilove_icedraw(struct ansilove_ctx *ctx, struct ansilove_options *options) } // create output file - if (output(ctx, options, canvas) != 0) + if (output(ctx, options, canvas) != 0) { + free(idf_buffer); return -1; + } // free memory free(idf_buffer);