boot0cfg: check result of malloc in read_mbr()
authorAlexander Kuleshov <kuleshovmail@gmail.com>
Tue, 8 Dec 2015 18:38:12 +0000 (00:38 +0600)
committerSascha Wildner <saw@online.de>
Thu, 24 Dec 2015 17:14:00 +0000 (18:14 +0100)
commit5f115e3b8fa054dfb6e59af424b0946871ca6cc0
treed5ec1e90df7a9ec7afc9e4872b35b16151eda44c
parentf5866fba04610d0124025c751de060117d8fdba6
boot0cfg: check result of malloc in read_mbr()

We allocating buffer for MBR in the read_mbr() function. The malloc()
may return NULL, so this patch checks the result of the malloc and
exit with the error if we can't allocate memory.

Besides this we close file descriptor.
usr.sbin/boot0cfg/boot0cfg.c