bigint: fixed memory leaks