On Fri, Sep 01, 2023 at 02:09:28AM +0000, Eric Wong wrote:
@@ -1202,7 +1203,9 @@ static void parse_pack_objects(unsigned char *hash)
/* Check pack integrity */
flush();
+ the_hash_algo->init_fn(&tmp_ctx);
does it make sense (and doesn't it potentially even cause a leak) to
init the target before cloning into it? at least the fallback simply
memcpy()s over it.
@@ -669,7 +670,9 @@ int cmd_unpack_objects(int argc, const char **argv, const char *prefix UNUSED)
the_hash_algo->init_fn(&ctx);
unpack_all();
the_hash_algo->update_fn(&ctx, buffer, offset);
+ the_hash_algo->init_fn(&tmp_ctx);
ditto
+ the_hash_algo->clone_fn(&tmp_ctx, &ctx);
+ the_hash_algo->final_oid_fn(&oid, &tmp_ctx);
regards