diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2018-12-06 12:59:17 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-06 12:59:17 -0800 |
commit | da8138b01217824cf211fa491608a7b067cf8e43 (patch) | |
tree | 6514538787d23d02c34967d0a78e3ad03fefff8e | |
parent | 8092c4315b1cf2c817bcb4c549216a647c9d6871 (diff) | |
parent | 2f3c4b69c96cf7f5b23c06c056ed4636932d80c0 (diff) | |
download | libgit2-da8138b01217824cf211fa491608a7b067cf8e43.tar.gz |
Merge pull request #4906 from QBobWatson/bugfix
Fix segfault in loose_backend__readstream
-rw-r--r-- | src/odb_loose.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/odb_loose.c b/src/odb_loose.c index 3c0ed674d..12607dd38 100644 --- a/src/odb_loose.c +++ b/src/odb_loose.c @@ -1028,11 +1028,15 @@ static int loose_backend__readstream( done: if (error < 0) { - git_futils_mmap_free(&stream->map); - git_zstream_free(&stream->zstream); - git_hash_ctx_cleanup(hash_ctx); - git__free(hash_ctx); - git__free(stream); + if (stream) { + git_futils_mmap_free(&stream->map); + git_zstream_free(&stream->zstream); + git__free(stream); + } + if (hash_ctx) { + git_hash_ctx_cleanup(hash_ctx); + git__free(hash_ctx); + } } git_buf_dispose(&object_path); |