diff options
author | Szymon Tokarz <wsx22@o2.pl> | 2016-01-17 00:02:29 +0000 |
---|---|---|
committer | Szymon Tokarz <wsx22@o2.pl> | 2016-01-17 00:02:29 +0000 |
commit | 67218eaf83e947cc7dd8a8be0224b90e0b35f31a (patch) | |
tree | 353067ac38d518b0271bf35f75707a40ada49e4a /protocols/Sametime/src/files.cpp | |
parent | efa07c67497a060009ebb5ec001dbd89684a4e17 (diff) |
Sametime protocol:
- patch fixes some memory leaks reported by Coverity and some other fixes and cleanup (by Wishmaster)
- some fixes by me
git-svn-id: http://svn.miranda-ng.org/main/trunk@16106 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Sametime/src/files.cpp')
-rw-r--r-- | protocols/Sametime/src/files.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/protocols/Sametime/src/files.cpp b/protocols/Sametime/src/files.cpp index 53141f1587..f0df47200d 100644 --- a/protocols/Sametime/src/files.cpp +++ b/protocols/Sametime/src/files.cpp @@ -128,7 +128,7 @@ void mwFileTransfer_opened(mwFileTransfer* ft) if (ftcd->sending) {
// create a thread to send chunks - since it seems not all clients send acks for each of our chunks!
- mir_forkthread(SendThread, (void*)ft);
+ mir_forkthread(SendThread, ft);
}
}
@@ -161,24 +161,28 @@ void mwFileTransfer_closed(mwFileTransfer* ft, guint32 code) proto->ProtoBroadcastAck(ftcd->hContact, ACKTYPE_FILE, ACKRESULT_FAILED, ftcd->hFt, 0);
if (ftcd->sending) {
- FileTransferClientData* ftcd_next = ftcd->next, *ftcd_temp;
+ FileTransferClientData* ftcd_next = ftcd->next;
while(ftcd_next) {
mwFileTransfer_free((mwFileTransfer*)ftcd_next->ft);
- ftcd_temp = ftcd_next->next;
+ FileTransferClientData *ftcd_temp = ftcd_next->next;
if (ftcd_next->hFile != INVALID_HANDLE_VALUE)
CloseHandle(ftcd->hFile);
- if (ftcd_next->save_path) free(ftcd_next->save_path);
- if (ftcd_next->buffer) delete[] ftcd_next->buffer;
+ if (ftcd_next->save_path)
+ free(ftcd_next->save_path);
+ if (ftcd_next->buffer)
+ delete[] ftcd_next->buffer;
delete ftcd_next;
ftcd_next = ftcd_temp;
}
}
else {
mwFileTransfer_removeClientData(ft);
- if (ftcd->save_path) free(ftcd->save_path);
- if (ftcd->buffer) delete[] ftcd->buffer;
+ if (ftcd->save_path)
+ free(ftcd->save_path);
+ if (ftcd->buffer)
+ delete[] ftcd->buffer;
delete ftcd;
mwFileTransfer_free(ft);
@@ -196,8 +200,10 @@ void mwFileTransfer_closed(mwFileTransfer* ft, guint32 code) proto->ProtoBroadcastAck(ftcd->hContact, ACKTYPE_FILE, ACKRESULT_SUCCESS, ftcd->hFt, 0);
mwFileTransfer_removeClientData(ft);
- if (ftcd->save_path) free(ftcd->save_path);
- if (ftcd->buffer) delete[] ftcd->buffer;
+ if (ftcd->save_path)
+ free(ftcd->save_path);
+ if (ftcd->buffer)
+ delete[] ftcd->buffer;
delete ftcd;
mwFileTransfer_free(ft);
@@ -303,7 +309,7 @@ HANDLE CSametimeProto::SendFilesToUser(MCONTACT hContact, TCHAR** files, const T ft = mwFileTransfer_new(service_files, &idb, T2Utf(ptszDesc), T2Utf(fn), filesize);
ftcd = new FileTransferClientData;
- memset((void*)ftcd, 0, sizeof(FileTransferClientData));
+ memset(ftcd, 0, sizeof(FileTransferClientData));
ftcd->ft = ft;
ftcd->hContact = hContact;
@@ -356,7 +362,7 @@ HANDLE CSametimeProto::AcceptFileTransfer(MCONTACT hContact, HANDLE hFt, char* s debugLog(_T("CSametimeProto::AcceptFileTransfer() start"));
FileTransferClientData* ftcd = new FileTransferClientData;
- memset((void*)ftcd, 0, sizeof(FileTransferClientData));
+ memset(ftcd, 0, sizeof(FileTransferClientData));
ftcd->ft = ft;
ftcd->sending = false;
ftcd->hFt = hFt;
|