diff options
author | Tomas Vanek <vanekt@fbl.cz> | 2019-12-20 23:48:46 +0100 |
---|---|---|
committer | Tomas Vanek <vanekt@fbl.cz> | 2020-01-16 09:46:12 +0000 |
commit | fe6bb7eac8c7028236306c562d24a25ef79d0c15 (patch) | |
tree | 011252ba20647c71911e5f8cab6bc539dbeccb60 /src/target | |
parent | 57afa176ce858ad6505a9a962df5d7e978d349bf (diff) | |
download | riscv-openocd-fe6bb7eac8c7028236306c562d24a25ef79d0c15.zip riscv-openocd-fe6bb7eac8c7028236306c562d24a25ef79d0c15.tar.gz riscv-openocd-fe6bb7eac8c7028236306c562d24a25ef79d0c15.tar.bz2 |
target/semihosting_common: fix minor memory leak
Reported by clang static analyzer.
Change-Id: Ie663f49d92588c0d8b502cfdd8fc34004b308066
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/5380
Reviewed-by: Liviu Ionescu <ilg@livius.net>
Tested-by: jenkins
Reviewed-by: Oleksij Rempel <linux@rempel-privat.de>
Diffstat (limited to 'src/target')
-rw-r--r-- | src/target/semihosting_common.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/target/semihosting_common.c b/src/target/semihosting_common.c index ce6a791..a41f8e4 100644 --- a/src/target/semihosting_common.c +++ b/src/target/semihosting_common.c @@ -944,6 +944,8 @@ int semihosting_common(struct target *target) uint8_t *fn1 = malloc(len1+1); uint8_t *fn2 = malloc(len2+1); if (!fn1 || !fn2) { + free(fn1); + free(fn2); semihosting->result = -1; semihosting->sys_errno = ENOMEM; } else { |