fix memory leak in copy_remote_dir_local

Bug https://code.google.com/p/android/issues/detail?id=82436

Change-Id: I4bfa865638742e1b7cedd17f5b33dcc10c7f711c