Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix leaked return of CFUUIDCreate() (reported by clang static analyze…

…r). Also make GC dual-mode safe by calling NSMakeCollectable() on return of CFUUIDCreateString()
  • Loading branch information...
commit b1fb2b9c658f25f620f57f90d23aa29d2f9622a3 1 parent 15227df
@ddribin authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 lib/NSURLRequest+postForm.m
View
8 lib/NSURLRequest+postForm.m
@@ -48,7 +48,13 @@ + (id)requestWithURL:(NSURL*)url postForm:(NSDictionary*)values {
// Create the mime multipart boundary.
// TODO scan `values` to ensure uniqueness of `boundary`. Loop+regen UUID if collision is discovered.
- NSString *uuid = [(id)CFUUIDCreateString(kCFAllocatorDefault, CFUUIDCreate(kCFAllocatorDefault)) autorelease];
+ CFUUIDRef cfUuid = CFUUIDCreate(kCFAllocatorDefault);
+ NSString * uuid = (id)CFUUIDCreateString(kCFAllocatorDefault, cfUuid);
+ CFRelease(cfUuid);
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5
+ uuid = NSMakeCollectable(uuid);
+#endif
+ uuid = [uuid autorelease];
NSString *boundary = [NSString stringWithFormat:@"x-mime-boundary://%@", uuid];
//--
Please sign in to comment.
Something went wrong with that request. Please try again.