Created
September 9, 2011 14:35
-
-
Save Gernot/1206389 to your computer and use it in GitHub Desktop.
ARC + Analyzer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ (NSString *)nx_stringWithUUID; | |
{ | |
CFUUIDRef theUUID = CFUUIDCreate(kCFAllocatorDefault); | |
CFStringRef string = CFUUIDCreateString(kCFAllocatorDefault, theUUID); | |
CFRelease(theUUID); | |
NSString *returnValue = (__bridge_transfer NSString*)string; | |
return returnValue; | |
/* | |
At this point I get the following Analyzer result: | |
/Users/gernot/Code/[...]/NSString+NXKit.m:25:5:{25:12-25:23}{21:5-21:59}: warning: Address of stack memory associated with local variable 'string' returned to caller | |
return returnValue; | |
^ ~~~~~~~~~~~ | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok, this seems like an Analyzer Bug. Here's a fix for line 7:
Thanks to @MrToto for the suggestion, I owe you a beer. :-)