Plug fd leaks
This commit is contained in:
parent
85df379184
commit
de028133d4
@ -370,6 +370,7 @@ load_dsdt(const char *dsdtfile)
|
||||
}
|
||||
if (fstat(fd, &sb) == -1) {
|
||||
perror("fstat");
|
||||
close(fd);
|
||||
return (-1);
|
||||
}
|
||||
code = mmap(NULL, (size_t)sb.st_size, PROT_READ, MAP_PRIVATE, fd, (off_t)0);
|
||||
|
@ -221,6 +221,7 @@ main(int argc, char *argv[])
|
||||
|
||||
free(firmware);
|
||||
firmware = NULL;
|
||||
fclose(firmware_file);
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
@ -330,10 +330,12 @@ read_mbr(const char *disk, u_int8_t **mbr, int check_version)
|
||||
err(1, "%s", disk);
|
||||
if (n != mbr_size)
|
||||
errx(1, "%s: short read", disk);
|
||||
close(fd);
|
||||
return (mbr_size);
|
||||
}
|
||||
*mbr = malloc(sizeof(buf));
|
||||
memcpy(*mbr, buf, sizeof(buf));
|
||||
close(fd);
|
||||
|
||||
return sizeof(buf);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user