git.y1.nz

gbdk-2020

GameBoy Development Kit
download: https://git.y1.nz/archives/gbdk.tar.gz
README | Files | Log | Refs | LICENSE

commit 484fff9209cd22bcf863a033269e3d9f0dbcaf1f
parent 07b5f07163bbbd500c583887f8386ecdc6cdb0b5
Author: Zalo <cebolleto@gmail.com>
Date:   Fri, 20 Nov 2020 16:08:50 +0100

Merge pull request #97 from jserv/cppcheck

Fix common realloc mistake
Diffstat:
Mgbdk-support/lcc/lcc.c8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gbdk-support/lcc/lcc.c b/gbdk-support/lcc/lcc.c @@ -406,8 +406,12 @@ static int callsys(char **av) { argc = i + 1; if (argv == NULL) argv = malloc(argc * sizeof *argv); - else - argv = realloc(argv, argc * sizeof *argv); + else { + char **argv0 = argv; + argv = realloc(argv0, argc * sizeof *argv); + if (argv == NULL) + free(argv0); + } assert(argv); } for (i = 0; status == 0 && av[i] != NULL; ) {

This webpage is intended to be an accessible preview of this repository. To get a fuller picture, clone it and use the git CLI.