svn commit: r227876 - in head/usr.sbin: acpi/acpidb bluetooth/bt3cfw boot0cfg

Kevin Lo kevlo at FreeBSD.org
Wed Nov 23 10:27:19 UTC 2011


Author: kevlo
Date: Wed Nov 23 10:27:18 2011
New Revision: 227876
URL: http://svn.freebsd.org/changeset/base/227876

Log:
  Plug fd leaks

Modified:
  head/usr.sbin/acpi/acpidb/acpidb.c
  head/usr.sbin/bluetooth/bt3cfw/bt3cfw.c
  head/usr.sbin/boot0cfg/boot0cfg.c

Modified: head/usr.sbin/acpi/acpidb/acpidb.c
==============================================================================
--- head/usr.sbin/acpi/acpidb/acpidb.c	Wed Nov 23 09:45:48 2011	(r227875)
+++ head/usr.sbin/acpi/acpidb/acpidb.c	Wed Nov 23 10:27:18 2011	(r227876)
@@ -370,6 +370,7 @@ load_dsdt(const char *dsdtfile)
 	}
 	if (fstat(fd, &sb) == -1) {
 		perror("fstat");
+		close(fd);
 		return (-1);
 	}
 	code = mmap(NULL, (size_t)sb.st_size, PROT_READ, MAP_PRIVATE, fd, (off_t)0);

Modified: head/usr.sbin/bluetooth/bt3cfw/bt3cfw.c
==============================================================================
--- head/usr.sbin/bluetooth/bt3cfw/bt3cfw.c	Wed Nov 23 09:45:48 2011	(r227875)
+++ head/usr.sbin/bluetooth/bt3cfw/bt3cfw.c	Wed Nov 23 10:27:18 2011	(r227876)
@@ -221,6 +221,7 @@ main(int argc, char *argv[])
 
 	free(firmware);
 	firmware = NULL;
+	fclose(firmware_file);
 
 	return (0);
 }

Modified: head/usr.sbin/boot0cfg/boot0cfg.c
==============================================================================
--- head/usr.sbin/boot0cfg/boot0cfg.c	Wed Nov 23 09:45:48 2011	(r227875)
+++ head/usr.sbin/boot0cfg/boot0cfg.c	Wed Nov 23 10:27:18 2011	(r227876)
@@ -330,10 +330,12 @@ read_mbr(const char *disk, u_int8_t **mb
 	    err(1, "%s", disk);
 	if (n != mbr_size)
 	    errx(1, "%s: short read", disk);
+	close(fd);
 	return (mbr_size);
     }
     *mbr = malloc(sizeof(buf));
     memcpy(*mbr, buf, sizeof(buf));
+    close(fd);
 
     return sizeof(buf);
 }


More information about the svn-src-all mailing list