From b7a9e9d6b2b0e87520aaffbf03a925ee402c2987 Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Wed, 11 Mar 2020 13:51:01 +0000 Subject: elfctl: remove memory leak CID: 1420356 Reported by: Coverity Scan Sponsored by: The FreeBSD Foundation --- usr.bin/elfctl/elfctl.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'usr.bin/elfctl') diff --git a/usr.bin/elfctl/elfctl.c b/usr.bin/elfctl/elfctl.c index bd8bac1280ac..f371d9cd6f52 100644 --- a/usr.bin/elfctl/elfctl.c +++ b/usr.bin/elfctl/elfctl.c @@ -352,6 +352,7 @@ get_file_features(Elf *elf, int phcount, int fd, uint32_t *features, descsz = roundup2(note.n_descsz, 4); if (read(fd, name, namesz) < namesz) { warnx("elf note name too short"); + free(name); return (false); } read_total += namesz; @@ -386,6 +387,7 @@ get_file_features(Elf *elf, int phcount, int fd, uint32_t *features, if (read(fd, features, sizeof(uint32_t)) < (ssize_t)sizeof(uint32_t)) { warnx("feature note data too short"); + free(name); return (false); } if (off != NULL) -- cgit v1.2.3