svn commit: r358889 - head/usr.bin/elfctl

Ed Maste emaste at FreeBSD.org
Wed Mar 11 13:51:02 UTC 2020


Author: emaste
Date: Wed Mar 11 13:51:01 2020
New Revision: 358889
URL: https://svnweb.freebsd.org/changeset/base/358889

Log:
  elfctl: remove memory leak
  
  CID:		1420356
  Reported by:	Coverity Scan
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/usr.bin/elfctl/elfctl.c

Modified: head/usr.bin/elfctl/elfctl.c
==============================================================================
--- head/usr.bin/elfctl/elfctl.c	Wed Mar 11 13:45:53 2020	(r358888)
+++ head/usr.bin/elfctl/elfctl.c	Wed Mar 11 13:51:01 2020	(r358889)
@@ -352,6 +352,7 @@ get_file_features(Elf *elf, int phcount, int fd, uint3
 			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, uint3
 			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)


More information about the svn-src-all mailing list