git: boot - Fix minor memory leak, statistics

Matthew Dillon dillon at
Sun Jul 26 21:50:03 PDT 2015

commit 63ad7bd43cbe77c9af63049a7bf93b51742e890f
Author: Matthew Dillon <dillon at>
Date:   Sun Jul 26 21:45:51 2015 -0700

    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.

Summary of changes:
 lib/libstand/close.c         |  2 +-
 lib/libstand/open.c          |  5 ++---
 lib/libstand/stand.h         |  3 ++-
 lib/libstand/zalloc_malloc.c |  6 ------
 sys/boot/common/dev_net.c    |  2 +-
 sys/boot/common/devopen.c    | 26 ++++++++++++++++++++++----
 sys/boot/pc32/libi386/pxe.c  |  3 ++-
 7 files changed, 30 insertions(+), 17 deletions(-)

DragonFly BSD source repository

More information about the Commits mailing list