aboutsummaryrefslogtreecommitdiff
path: root/src/target/semihosting_common.c
diff options
context:
space:
mode:
authorTomas Vanek <vanekt@fbl.cz>2019-12-20 23:48:46 +0100
committerTomas Vanek <vanekt@fbl.cz>2020-01-16 09:46:12 +0000
commitfe6bb7eac8c7028236306c562d24a25ef79d0c15 (patch)
tree011252ba20647c71911e5f8cab6bc539dbeccb60 /src/target/semihosting_common.c
parent57afa176ce858ad6505a9a962df5d7e978d349bf (diff)
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/semihosting_common.c')
-rw-r--r--src/target/semihosting_common.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/target/semihosting_common.c b/src/target/semihosting_common.c
index ce6a7917..a41f8e4c 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 {