diff options
author | Ed Maste <emaste@FreeBSD.org> | 2020-03-11 13:51:01 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2020-03-11 13:51:01 +0000 |
commit | b7a9e9d6b2b0e87520aaffbf03a925ee402c2987 (patch) | |
tree | 72db6dcf9644c6bee29f52337ddfd8b9e0bd614b /usr.bin/elfctl | |
parent | 0fc06121ac9ed5b6aa9b0d6de0bf78cb9062ab4c (diff) | |
download | src-b7a9e9d6b2b0e87520aaffbf03a925ee402c2987.tar.gz src-b7a9e9d6b2b0e87520aaffbf03a925ee402c2987.zip |
elfctl: remove memory leak
CID: 1420356
Reported by: Coverity Scan
Sponsored by: The FreeBSD Foundation
Notes
Notes:
svn path=/head/; revision=358889
Diffstat (limited to 'usr.bin/elfctl')
-rw-r--r-- | usr.bin/elfctl/elfctl.c | 2 |
1 files changed, 2 insertions, 0 deletions
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) |