elfctl: remove memory leak

CID:		1420356
Reported by:	Coverity Scan
Sponsored by:	The FreeBSD Foundation
This commit is contained in:
emaste 2020-03-11 13:51:01 +00:00
parent aeb44e2812
commit d1e9acacaa

View File

@ -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)