1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-28 05:34:47 +01:00

Proper cleanup.

This commit is contained in:
Martin Tůma 2017-06-25 12:34:48 +02:00
parent ad154dfd7d
commit 1a8114af8e

View File

@ -73,12 +73,14 @@ bool Tar::loadTar()
while ((ret = _file.read(buffer, BLOCKSIZE)) > 0) { while ((ret = _file.read(buffer, BLOCKSIZE)) > 0) {
if (ret < BLOCKSIZE) { if (ret < BLOCKSIZE) {
_file.close(); _file.close();
_index.clear();
return false; return false;
} }
size = number(hdr->size, sizeof(hdr->size)); size = number(hdr->size, sizeof(hdr->size));
_index.insert(hdr->name, _file.pos() / BLOCKSIZE - 1); _index.insert(hdr->name, _file.pos() / BLOCKSIZE - 1);
if (!_file.seek(_file.pos() + BLOCKCOUNT(size) * BLOCKSIZE)) { if (!_file.seek(_file.pos() + BLOCKCOUNT(size) * BLOCKSIZE)) {
_file.close(); _file.close();
_index.clear();
return false; return false;
} }
} }