diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-11-29 16:48:17 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-11-29 16:48:17 +0000 |
commit | c3d7973137de833eec2d207522dfc2c6b8cab531 (patch) | |
tree | f90cc0d8bc5e679ad505e2c40a7d026f1101a493 | |
parent | 8888e419e1e874564c8bb5107a642bc6f86a3e05 (diff) |
Dropbox: file leak fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@15786 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/Dropbox/src/dropbox_transfers.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/plugins/Dropbox/src/dropbox_transfers.cpp b/plugins/Dropbox/src/dropbox_transfers.cpp index b658731249..e1fe957b05 100644 --- a/plugins/Dropbox/src/dropbox_transfers.cpp +++ b/plugins/Dropbox/src/dropbox_transfers.cpp @@ -144,31 +144,31 @@ UINT CDropbox::SendFilesAsync(void *owner, void *arg) char *data = (char*)mir_alloc(chunkSize);
while (!feof(hFile) && fileSize != offset)
{
- if (ferror(hFile))
- throw TransferException("Error while file sending");
+ try
+ {
+ if (ferror(hFile))
+ throw TransferException("Error while file sending");
- if (ftp->isTerminated)
- throw TransferException("Transfer was terminated");
+ if (ftp->isTerminated)
+ throw TransferException("Transfer was terminated");
- size_t size = fread(data, sizeof(char), chunkSize, hFile);
+ size_t size = fread(data, sizeof(char), chunkSize, hFile);
- try
- {
if (offset == 0)
instance->SendFileChunkedFirst(data, size, uploadId, offset);
else
instance->SendFileChunkedNext(data, size, uploadId, offset);
+
+ ftp->pfts.currentFileProgress += size;
+ ftp->pfts.totalProgress += size;
}
- catch (TransferException)
+ catch (TransferException&)
{
mir_free(data);
fclose(hFile);
throw;
}
- ftp->pfts.currentFileProgress += size;
- ftp->pfts.totalProgress += size;
-
ProtoBroadcastAck(MODULE, ftp->pfts.hContact, ACKTYPE_FILE, ACKRESULT_DATA, ftp->hProcess, (LPARAM)&ftp->pfts);
}
mir_free(data);
|