Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

GetFlavorType leaking a CFStringRef (16 bytes)



Dear All,

I am seeing a CFStringRef leak when I call GetFlavorType on a drag that I am receiving. The string appears to be a description of the flavorType.

I have sample code (below) that shows the leak quite clearly in when I launch a simple Carbon C++ project using MallocDebug within Xcode. If I comment out the GetFlavorType call then there are no leaks in this code.

I am going to radar this presently, but thought I would ask for comments beforehand in case I have overlooked something fundamental.

Thanks

Douglas



#include <Carbon/Carbon.h>

//---------------------------------------------------------------------- ----------------------

void DoLeakTest()
	{
	DragRef theDrag = NULL;
	
	FSRef rootFolderRef = {0};
	HFSFlavor hfsFlavor = {0};
	OSType flavorType = '\0\0\0\0';

if ( noErr == NewDrag( &theDrag ) )
{
if ( noErr == FSFindFolder( kOnSystemDisk, kVolumeRootFolderType, kDontCreateFolder, &rootFolderRef ) )
{
hfsFlavor.fileType = 'fold';
hfsFlavor.fileCreator = 'MACS';

if ( noErr == FSGetCatalogInfo( &rootFolderRef, kFSCatInfoNone, NULL, NULL, &hfsFlavor.fileSpec, NULL ) )
{
if ( noErr == AddDragItemFlavor( theDrag, 1, kDragFlavorTypeHFS, &hfsFlavor, sizeof(HFSFlavor), 0 ) )
{
GetFlavorType( theDrag, 1, 1, &flavorType );
}
}
}

DisposeDrag( theDrag );
}
}


//---------------------------------------------------------------------- ----------------------

int main(int argc, char* argv[])
	{
	DoLeakTest();

    RunApplicationEventLoop();
    return 0;
	}

//---------------------------------------------------------------------- ----------------------



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Carbon-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/carbon-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.