libansilove

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

commit 1c441b2ba49d03e96cd7dbfc0c45639f46d00ea4
parent 5693e9ff96a3970af54343bb8de5ecd5e88697ee
Author: Frederic Cambus <fred@statdns.com>
Date:   Mon, 11 Feb 2019 09:59:12 +0100

Some more realloc love in the IDF loader.

Diffstat:
Msrc/loaders/icedraw.c | 7++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/loaders/icedraw.c b/src/loaders/icedraw.c @@ -82,12 +82,13 @@ ansilove_icedraw(struct ansilove_ctx *ctx, struct ansilove_options *options) loop += 4; } else { /* reallocate IDF buffer memory */ - idf_buffer = realloc(idf_buffer, i + 2); - if (idf_buffer == NULL) { + ptr = realloc(idf_buffer, i + 2); + if (ptr == NULL) { ctx->error = ANSILOVE_MEMORY_ERROR; free(idf_buffer); - idf_buffer = NULL; return -1; + } else { + idf_buffer = ptr; } /* normal character */