impl Drop for CryptoHasher {
fn drop(&mut self) {
- unsafe { c::git_hash_free(self.ctx) };
+ unsafe {
+ c::git_hash_discard(self.ctx);
+ c::git_hash_free(self.ctx);
+ };
}
}
pub fn git_hash_clone(dst: *mut c_void, src: *const c_void);
pub fn git_hash_update(ctx: *mut c_void, inp: *const c_void, len: usize);
pub fn git_hash_final(hash: *mut u8, ctx: *mut c_void);
+ pub fn git_hash_discard(ctx: *mut c_void);
pub fn git_hash_final_oid(hash: *mut c_void, ctx: *mut c_void);
}
}
h.update(&data[2..]);
let h2 = h.clone();
+ let h3 = h2.clone();
let actual_oid = h.into_oid();
assert_eq!(**oid, actual_oid);
let actual_oid = h.into_oid();
assert_eq!(**oid, actual_oid);
+ std::mem::drop(h3);
}
}
}