Fix the precious change to check the pointer returned by malloc().

Submitted by:	luke <luke.tw@gmail.com>
Pointy hat to:	jhb
This commit is contained in:
John Baldwin 2015-12-18 17:52:08 +00:00
parent 2351669e6d
commit 32960dd10a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=292443

View file

@ -337,7 +337,7 @@ read_mbr(const char *disk, u_int8_t **mbr, int check_version)
return (mbr_size);
}
*mbr = malloc(sizeof(buf));
if (mbr == NULL)
if (*mbr == NULL)
errx(1, "%s: unable to allocate MBR buffer", disk);
memcpy(*mbr, buf, sizeof(buf));
close(fd);