From 3be05c18025be1d74936f5bda36c9ee278c4ef2a Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Mon, 23 Feb 2015 16:10:53 +0000 Subject: FltContacts: - Fixed memory leak git-svn-id: http://svn.miranda-ng.org/main/trunk@12247 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/FloatingContacts/src/filedrop.cpp | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) (limited to 'plugins/FloatingContacts/src/filedrop.cpp') diff --git a/plugins/FloatingContacts/src/filedrop.cpp b/plugins/FloatingContacts/src/filedrop.cpp index 64ee8db693..586b1419aa 100644 --- a/plugins/FloatingContacts/src/filedrop.cpp +++ b/plugins/FloatingContacts/src/filedrop.cpp @@ -176,16 +176,20 @@ BOOL OnDropFiles( HDROP hDrop, ThumbInfo *pThumb ) char **ppFiles = ( char** )malloc( sizeof( char *)* ( nFilesCount+1)); - if ( ppFiles == NULL ) + BOOL bSuccess = FALSE; + if (ppFiles != NULL) { - return FALSE; - } - - ppFiles[ nFilesCount] = NULL; + ppFiles[nFilesCount] = NULL; + + ProcessDroppedItems(ppDroppedItems, nDroppedItemsCount, ppFiles); + + bSuccess = (BOOL)CallService(MS_CLIST_CONTACTFILESDROPPED, (WPARAM)pThumb->hContact, (LPARAM)ppFiles); - ProcessDroppedItems( ppDroppedItems, nDroppedItemsCount, ppFiles ); + for (UINT iItem = 0; iItem < nFilesCount ; ++iItem ) + free(ppFiles[iItem]); - BOOL bSuccess = (BOOL)CallService(MS_CLIST_CONTACTFILESDROPPED, (WPARAM)pThumb->hContact, (LPARAM)ppFiles ); + free(ppFiles); + } // Cleanup for (UINT iItem = 0; ppDroppedItems[ iItem ]; ++iItem ) @@ -195,13 +199,6 @@ BOOL OnDropFiles( HDROP hDrop, ThumbInfo *pThumb ) free( ppDroppedItems ); - for (UINT iItem = 0; iItem < nFilesCount ; ++iItem ) - { - free( ppFiles[ iItem ] ); - } - - free( ppFiles ); - return bSuccess; } -- cgit v1.2.3