diff options
| author | Vicent Martà <tanoku@gmail.com> | 2011-07-05 06:35:45 -0700 |
|---|---|---|
| committer | Vicent Martà <tanoku@gmail.com> | 2011-07-05 06:35:45 -0700 |
| commit | 2f3f28b4628db5699c2b847a81bbef8445719a00 (patch) | |
| tree | c868b8639be27c236e9f2d74e1b91f280fa215e8 /src | |
| parent | e45e548a7e60f20f36be8d657ec253807db1673b (diff) | |
| parent | 2ee318a7bc5f7e975e31ca03d0e275fa3619633e (diff) | |
| download | libgit2-2f3f28b4628db5699c2b847a81bbef8445719a00.tar.gz | |
Merge pull request #302 from carlosmn/development
Small fixes in pack_window_open
Diffstat (limited to 'src')
| -rw-r--r-- | src/odb_pack.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/odb_pack.c b/src/odb_pack.c index 59661a662..44604ef91 100644 --- a/src/odb_pack.c +++ b/src/odb_pack.c @@ -480,6 +480,9 @@ static unsigned char *pack_window_open( size_t len; win = git__calloc(1, sizeof(*win)); + if (win == NULL) + return NULL; + win->offset = (offset / window_align) * window_align; len = (size_t)(p->pack_size - win->offset); @@ -492,8 +495,10 @@ static unsigned char *pack_window_open( pack_window_close_lru(backend, p, p->pack_fd) == GIT_SUCCESS) {} if (git_futils_mmap_ro(&win->window_map, p->pack_fd, - win->offset, len) < GIT_SUCCESS) + win->offset, len) < GIT_SUCCESS) { + free(win); return NULL; + } backend->mmap_calls++; backend->open_windows++; |
