Open orarbel opened 12 years ago
I can confirm this bug. Instruments output:
Address Category Event Type RefCt Timestamp Size Responsible Library Responsible Caller 0x2a78b0 Malloc 128 Bytes Malloc 1 00:04.481.486 128 libsystem_c.dylib vasprintf_l 0x2a78b0 Malloc 128 Bytes Free 0 00:04.486.926 -128 Foundation NSLogv 0x2a78b0 CFString (store) Malloc 1 00:04.488.444 64 TheApp +[OpenUDID valueWithError:]
Just ran into Instruments reporting this leak as well which is odd since I'm using the version with the following:
NSString * appUID = (NSString *) [defaults objectForKey:kOpenUDIDAppUIDKey];
if(appUID == nil)
{
// generate a new uuid and store it in user defaults
CFUUIDRef uuid = CFUUIDCreate(NULL);
appUID = (NSString *) CFUUIDCreateString(NULL, uuid);
CFRelease(uuid);
}
why is it weird? it's the same code as i reported that leaks
NSString * appUID = (NSString *) [defaults objectForKey:kOpenUDIDAppUIDKey]; if(appUID == nil) { // generate a new uuid and store it in user defaults CFUUIDRef uuid = CFUUIDCreate(NULL); appUID = (CFBridgingRelease(CFUUIDCreateString(NULL, uuid))); CFRelease(uuid); }
NSString * guuid = [(NSString ) [defaults objectForKey:kAppGUUID] retain]; if(guuid == nil) { //generate a new uuid and store it in user defaults CFUUIDRef uuid = CFUUIDCreate(NULL); guuid = (NSString ) CFUUIDCreateString(NULL, uuid); CFRelease(uuid); }
if guuid was nil and created within the if block, it is never released