diff options
| author | lhchavez <lhchavez@lhchavez.com> | 2020-06-27 12:33:32 -0700 |
|---|---|---|
| committer | lhchavez <lhchavez@lhchavez.com> | 2020-06-30 06:25:10 -0700 |
| commit | 3a197ea7ead1bc1b018eb809e92f418a00e5c3f8 (patch) | |
| tree | 782324566a568dc45ff7ee7599eafa48a8f2442e /src/diff_file.c | |
| parent | d6c62852076005053be9169cb4f3cd9cf9db2aea (diff) | |
| download | libgit2-3a197ea7ead1bc1b018eb809e92f418a00e5c3f8.tar.gz | |
Make the tests pass cleanly with MemorySanitizer
This change:
* Initializes a few variables that were being read before being
initialized.
* Includes https://github.com/madler/zlib/pull/393. As such,
it only works reliably with `-DUSE_BUNDLED_ZLIB=ON`.
Diffstat (limited to 'src/diff_file.c')
| -rw-r--r-- | src/diff_file.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/diff_file.c b/src/diff_file.c index 621bff556..015e0706b 100644 --- a/src/diff_file.c +++ b/src/diff_file.c @@ -160,8 +160,10 @@ int git_diff_file_content__init_from_src( fc->flags |= GIT_DIFF_FLAG__FREE_BLOB; } else { + int error; + if ((error = git_odb_hash(&fc->file->id, src->buf, src->buflen, GIT_OBJECT_BLOB)) < 0) + return error; fc->file->size = src->buflen; - git_odb_hash(&fc->file->id, src->buf, src->buflen, GIT_OBJECT_BLOB); fc->file->id_abbrev = GIT_OID_HEXSZ; fc->map.len = src->buflen; |
