fix memleaks in libtar sample program