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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user