diff-lib: plug minor memory leaks in do_diff_cache()