diff options
author | Minh Nguyễn <mxn@1ec5.org> | 2015-05-05 11:33:39 -0400 |
---|---|---|
committer | Minh Nguyễn <mxn@1ec5.org> | 2015-05-05 11:33:39 -0400 |
commit | ec241d17ff4600899a7da9bce1074341e30a6a71 (patch) | |
tree | bea8de82a937e5428278dcf3432280e73204ccfb | |
parent | fab65e75d0b13a5d03eaea151bb63f2fc6b76bd0 (diff) | |
download | qtlocation-mapboxgl-ec241d17ff4600899a7da9bce1074341e30a6a71.tar.gz |
Fixed NSMutableString leak
Fixed analyzer warnings in http-nsurl target, which is MRR rather than ARC.
-rw-r--r-- | platform/darwin/http_request_nsurl.mm | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/platform/darwin/http_request_nsurl.mm b/platform/darwin/http_request_nsurl.mm index 509e158afd..0006dbef80 100644 --- a/platform/darwin/http_request_nsurl.mm +++ b/platform/darwin/http_request_nsurl.mm @@ -153,7 +153,7 @@ void HTTPRequest::start() { @autoreleasepool { - NSMutableString *url = [[NSMutableString alloc] initWithString:@(resource.url.c_str())]; + NSMutableString *url = [NSMutableString stringWithString:@(resource.url.c_str())]; if ([[NSUserDefaults standardUserDefaults] objectForKey:@"mapbox_metrics_disabled"] == nil) { if ([url rangeOfString:@"?"].location == NSNotFound) { [url appendString:@"?"]; @@ -163,8 +163,7 @@ void HTTPRequest::start() { [url appendString:@"events=true"]; } - NSMutableURLRequest *req = [[NSMutableURLRequest alloc] - initWithURL:[NSURL URLWithString:url]]; + NSMutableURLRequest *req = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]]; if (existingResponse) { if (!existingResponse->etag.empty()) { [req addValue:@(existingResponse->etag.c_str()) forHTTPHeaderField:@"If-None-Match"]; @@ -179,7 +178,6 @@ void HTTPRequest::start() { task = [context->session dataTaskWithRequest:req completionHandler:^(NSData *data, NSURLResponse *res, NSError *error) { handleResult(data, res, error); }]; - [req release]; [task retain]; [task resume]; } |