mirror of
https://github.com/git/git
synced 2024-08-25 02:35:46 +00:00
Merge branch 'rs/git-mmap-uses-malloc' into maint
mmap() imitation used to call xmalloc() that dies upon malloc() failure, which has been corrected to just return an error to the caller to be handled. * rs/git-mmap-uses-malloc: compat: let git_mmap use malloc(3) directly
This commit is contained in:
commit
ae9e6ef35e
|
@ -7,7 +7,12 @@ void *git_mmap(void *start, size_t length, int prot, int flags, int fd, off_t of
|
|||
if (start != NULL || flags != MAP_PRIVATE || prot != PROT_READ)
|
||||
die("Invalid usage of mmap when built with NO_MMAP");
|
||||
|
||||
start = xmalloc(length);
|
||||
if (length == 0) {
|
||||
errno = EINVAL;
|
||||
return MAP_FAILED;
|
||||
}
|
||||
|
||||
start = malloc(length);
|
||||
if (start == NULL) {
|
||||
errno = ENOMEM;
|
||||
return MAP_FAILED;
|
||||
|
|
Loading…
Reference in a new issue