boot - Fix minor memory leak, statistics
commit63ad7bd43cbe77c9af63049a7bf93b51742e890f
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 27 Jul 2015 04:45:51 +0000 (26 21:45 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 27 Jul 2015 04:45:51 +0000 (26 21:45 -0700)
treeb718b76b52f4f74dad54578f2c2a3d108d8bbb3c
parentda0f7859d0ec9815fa217d4beeb6727df195e13e
boot - Fix minor memory leak, statistics

* open() calls devopen() which installs a generic malloc'd device
  wrapper in f->f_devdata.  However, some devices will replace this
  with their own descriptor.

  Add F_DEVDESC to indicate when f->f_devdata contains this generic
  object, free and clear the generic object when replacing f_devdata
  in particular devices.

  This fixes a minor memory leak of 192 bytes on open()s made by the boot
  code when booting from e.g. PXE.

* Fix incorrect MallocCount statistics.  calloc() and realloc() were
  improperly incrementing the global, even though the malloc() call they
  both make also increments it.

* Remove the unused F_NODEV flag.  This flag is never set, collapse the
  related code.
lib/libstand/close.c
lib/libstand/open.c
lib/libstand/stand.h
lib/libstand/zalloc_malloc.c
sys/boot/common/dev_net.c
sys/boot/common/devopen.c
sys/boot/pc32/libi386/pxe.c