diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2019-04-30 07:14:09 +0200 |
---|---|---|
committer | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2019-05-02 18:17:50 +0200 |
commit | 45203e0ccbfaab5eafe3b6a7b8bb742182a83077 (patch) | |
tree | 02583f97cdaa22e30e7aee8d4007423cd51a5788 /cmd/nvedit_efi.c | |
parent | 39a1ff8ceab4b74164b2e19217206e7226aa9cd8 (diff) | |
download | u-boot-45203e0ccbfaab5eafe3b6a7b8bb742182a83077.zip u-boot-45203e0ccbfaab5eafe3b6a7b8bb742182a83077.tar.gz u-boot-45203e0ccbfaab5eafe3b6a7b8bb742182a83077.tar.bz2 |
efi_loader: memory leak in append value
When printing an UEFI variable an error may arise while converting an
illegal hexadecimal value. In this case a buffer is leaked.
Close the memory leak. Provide an error message.
Reported-by: Coverity (CID 185830)
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Diffstat (limited to 'cmd/nvedit_efi.c')
-rw-r--r-- | cmd/nvedit_efi.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/cmd/nvedit_efi.c b/cmd/nvedit_efi.c index e65b38d..2805e81 100644 --- a/cmd/nvedit_efi.c +++ b/cmd/nvedit_efi.c @@ -291,8 +291,11 @@ static int append_value(char **bufp, size_t *sizep, char *data) if (!tmp_buf) return -1; - if (hex2bin((u8 *)tmp_buf, data, len) < 0) + if (hex2bin((u8 *)tmp_buf, data, len) < 0) { + printf("Error: illegal hexadecimal string\n"); + free(tmp_buf); return -1; + } value = tmp_buf; } else { /* string */ |