Skip to content

Commit

Permalink
Fix memory leak when error reported
Browse files Browse the repository at this point in the history
Change-Id: I0c4c0baed8f2a734b3986b0d446cd58df705f7e4
Reviewed-by: David Faure <[email protected]>
  • Loading branch information
Montel Laurent authored and The Qt Project committed Dec 1, 2012
1 parent 14fcddc commit a9fcfa6
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/network/torrent/filemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ bool FileManager::generateFiles()
errString = tr("Failed to open/create file %1: %2")
.arg(file->fileName()).arg(file->errorString());
emit error();
delete file;
return false;
}

Expand All @@ -241,6 +242,7 @@ bool FileManager::generateFiles()
if (!file->resize(singleFile.length)) {
errString = tr("Failed to resize file %1: %2")
.arg(file->fileName()).arg(file->errorString());
delete file;
emit error();
return false;
}
Expand Down Expand Up @@ -288,6 +290,7 @@ bool FileManager::generateFiles()
errString = tr("Failed to open/create file %1: %2")
.arg(file->fileName()).arg(file->errorString());
emit error();
delete file;
return false;
}

Expand All @@ -297,6 +300,7 @@ bool FileManager::generateFiles()
errString = tr("Failed to resize file %1: %2")
.arg(file->fileName()).arg(file->errorString());
emit error();
delete file;
return false;
}
}
Expand Down

0 comments on commit a9fcfa6

Please sign in to comment.