svn commit: r298374 - head/usr.sbin/mpsutil
Baptiste Daroussin
bapt at FreeBSD.org
Wed Apr 20 21:11:51 UTC 2016
Author: bapt
Date: Wed Apr 20 21:11:49 2016
New Revision: 298374
URL: https://svnweb.freebsd.org/changeset/base/298374
Log:
Plug leaks
Reported by: Coverity
CID: 1340155 and 1340156
MFC after: 1 week
Modified:
head/usr.sbin/mpsutil/mps_flash.c
Modified: head/usr.sbin/mpsutil/mps_flash.c
==============================================================================
--- head/usr.sbin/mpsutil/mps_flash.c Wed Apr 20 21:04:39 2016 (r298373)
+++ head/usr.sbin/mpsutil/mps_flash.c Wed Apr 20 21:11:49 2016 (r298374)
@@ -83,6 +83,7 @@ flash_save(int argc, char **argv)
if ((size = mps_firmware_get(fd, &firmware_buffer, bios)) < 0) {
warnx("Fail to save %s", argv[1]);
+ close(fd);
return (1);
}
@@ -100,6 +101,7 @@ flash_save(int argc, char **argv)
error = errno;
warn("write");
free(firmware_buffer);
+ close(fd);
return (error);
}
written += ret;
@@ -189,12 +191,14 @@ flash_update(int argc, char **argv)
warnx("Invalid bios: no boot record magic number");
munmap(mem, st.st_size);
close(fd);
+ free(facts);
return (1);
}
if ((st.st_size % 512) != 0) {
warnx("Invalid bios: size not a multiple of 512");
munmap(mem, st.st_size);
close(fd);
+ free(facts);
return (1);
}
} else {
@@ -206,6 +210,7 @@ flash_update(int argc, char **argv)
warnx(" Image Vendor ID: %04x", fwheader->VendorID);
munmap(mem, st.st_size);
close(fd);
+ free(facts);
return (1);
}
@@ -215,6 +220,7 @@ flash_update(int argc, char **argv)
warnx(" Image Product ID: %04x", fwheader->ProductID);
munmap(mem, st.st_size);
close(fd);
+ free(facts);
return (1);
}
}
@@ -224,11 +230,13 @@ flash_update(int argc, char **argv)
warnx("Fail to update %s", argv[1]);
munmap(mem, st.st_size);
close(fd);
+ free(facts);
return (1);
}
munmap(mem, st.st_size);
close(fd);
+ free(facts);
printf("%s successfully updated\n", argv[1]);
return (0);
}
More information about the svn-src-head
mailing list