Fix minor memory leaks under OS X

Two wxDataFormat arrays are not deleted. Use a wxScopedArray to delete
them after usage (not using delete[] in case the functions ever have
multiple exit points which makes it easier to forget adding them).
This commit is contained in:
Dimitri Schoolwerth
2015-05-22 03:12:41 +04:00
parent cc81acecc1
commit 0bee861d16

View File

@@ -24,6 +24,7 @@
#include "wx/mstream.h"
#include "wx/metafile.h"
#include "wx/scopedarray.h"
#include "wx/tokenzr.h"
#include "wx/filename.h"
@@ -391,8 +392,8 @@ bool wxDataObject::GetFromPasteboard( void * pb )
PasteboardRef pasteboard = (PasteboardRef) pb;
size_t formatcount = GetFormatCount(wxDataObject::Set);
wxDataFormat *array = new wxDataFormat[ formatcount ];
GetAllFormats(array, wxDataObject::Set);
wxScopedArray<wxDataFormat> array(formatcount);
GetAllFormats(array.get(), wxDataObject::Set);
ItemCount itemCount = 0;
wxString filenamesPassed;
@@ -535,8 +536,8 @@ bool wxDataObject::HasDataInPasteboard( void * pb )
{
PasteboardRef pasteboard = (PasteboardRef) pb;
size_t formatcount = GetFormatCount(wxDataObject::Set);
wxDataFormat *array = new wxDataFormat[ formatcount ];
GetAllFormats(array, wxDataObject::Set);
wxScopedArray<wxDataFormat> array(formatcount);
GetAllFormats(array.get(), wxDataObject::Set);
ItemCount itemCount = 0;
bool hasData = false;