@@ -120,6 +120,7 @@ int git_indexer_new(
120
120
idx -> progress_cb = progress_cb ;
121
121
idx -> progress_payload = progress_payload ;
122
122
idx -> mode = mode ? mode : GIT_PACK_FILE_MODE ;
123
+ git_hash_ctx_init (& idx -> hash_ctx );
123
124
git_hash_ctx_init (& idx -> trailer );
124
125
125
126
error = git_buf_joinpath (& path , prefix , suff );
@@ -265,7 +266,6 @@ static int store_object(git_indexer *idx)
265
266
struct entry * entry ;
266
267
git_off_t entry_size ;
267
268
struct git_pack_entry * pentry ;
268
- git_hash_ctx * ctx = & idx -> hash_ctx ;
269
269
git_off_t entry_start = idx -> entry_start ;
270
270
271
271
entry = git__calloc (1 , sizeof (* entry ));
@@ -274,7 +274,7 @@ static int store_object(git_indexer *idx)
274
274
pentry = git__calloc (1 , sizeof (struct git_pack_entry ));
275
275
GITERR_CHECK_ALLOC (pentry );
276
276
277
- git_hash_final (& oid , ctx );
277
+ git_hash_final (& oid , & idx -> hash_ctx );
278
278
entry_size = idx -> off - entry_start ;
279
279
if (entry_start > UINT31_MAX ) {
280
280
entry -> offset = UINT32_MAX ;
@@ -557,7 +557,7 @@ int git_indexer_append(git_indexer *idx, const void *data, size_t size, git_tran
557
557
558
558
git_mwindow_close (& w );
559
559
idx -> entry_start = entry_start ;
560
- git_hash_ctx_init (& idx -> hash_ctx );
560
+ git_hash_init (& idx -> hash_ctx );
561
561
562
562
if (type == GIT_OBJ_REF_DELTA || type == GIT_OBJ_OFS_DELTA ) {
563
563
error = advance_delta_offset (idx , type );
@@ -843,12 +843,10 @@ static int update_header_and_rehash(git_indexer *idx, git_transfer_progress *sta
843
843
git_mwindow * w = NULL ;
844
844
git_mwindow_file * mwf ;
845
845
unsigned int left ;
846
- git_hash_ctx * ctx ;
847
846
848
847
mwf = & idx -> pack -> mwf ;
849
- ctx = & idx -> trailer ;
850
848
851
- git_hash_ctx_init ( ctx );
849
+ git_hash_init ( & idx -> trailer );
852
850
853
851
854
852
/* Update the header to include the numer of local objects we injected */
@@ -1061,5 +1059,7 @@ void git_indexer_free(git_indexer *idx)
1061
1059
git_mutex_unlock (& git__mwindow_mutex );
1062
1060
}
1063
1061
1062
+ git_hash_ctx_cleanup (& idx -> trailer );
1063
+ git_hash_ctx_cleanup (& idx -> hash_ctx );
1064
1064
git__free (idx );
1065
1065
}
0 commit comments