[mach-o] fix memory ownership in test case