mirror of
https://github.com/mtrojnar/osslsigncode.git
synced 2025-04-09 18:48:05 -05:00
Close a file descriptor, CID 1208035
This commit is contained in:
parent
b0eaa96d45
commit
bb6322e378
@ -4881,15 +4881,17 @@ static char *map_file(const char *infile, const size_t size)
|
|||||||
indata = (char *)MapViewOfFile(fmap, FILE_MAP_READ, 0, 0, 0);
|
indata = (char *)MapViewOfFile(fmap, FILE_MAP_READ, 0, 0, 0);
|
||||||
CloseHandle(fmap);
|
CloseHandle(fmap);
|
||||||
#else
|
#else
|
||||||
|
#ifdef HAVE_SYS_MMAN_H
|
||||||
int fd = open(infile, O_RDONLY);
|
int fd = open(infile, O_RDONLY);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_SYS_MMAN_H
|
|
||||||
indata = mmap(0, size, PROT_READ, MAP_PRIVATE, fd, 0);
|
indata = mmap(0, size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||||
if (indata == MAP_FAILED) {
|
if (indata == MAP_FAILED) {
|
||||||
|
close(fd);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
close(fd);
|
||||||
#else
|
#else
|
||||||
printf("No file mapping function\n");
|
printf("No file mapping function\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user