Merge topic 'fix_tar_leaks'

57a2df22 Fix memory leaks in extract tar.
This commit is contained in:
Brad King 2014-07-28 10:35:44 -04:00 committed by CMake Topic Stage
commit 90f6de8a01
1 changed files with 3 additions and 0 deletions

View File

@ -1701,6 +1701,8 @@ bool extract_tar(const char* outFileName, bool verbose,
{ {
cmSystemTools::Error("Problem with archive_read_open_file(): ", cmSystemTools::Error("Problem with archive_read_open_file(): ",
archive_error_string(a)); archive_error_string(a));
archive_write_free(ext);
archive_read_close(a);
return false; return false;
} }
for (;;) for (;;)
@ -1776,6 +1778,7 @@ bool extract_tar(const char* outFileName, bool verbose,
} }
} }
} }
archive_write_free(ext);
archive_read_close(a); archive_read_close(a);
archive_read_finish(a); archive_read_finish(a);
return r == ARCHIVE_EOF || r == ARCHIVE_OK; return r == ARCHIVE_EOF || r == ARCHIVE_OK;