Skip to content

Commit

Permalink
Merge pull request #502 from photomadic/fix/upload-job-retained
Browse files Browse the repository at this point in the history
fix(upload): prevent memory leaks from retained jobs
  • Loading branch information
itinance authored Jun 9, 2018
2 parents 9b130ad + 7dbe488 commit 8468d43
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions RNFSManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,7 @@ + (BOOL)requiresMainQueueSetup
params.method = method;

params.completeCallback = ^(NSString* body, NSURLResponse *resp) {
[self.uploaders removeObjectForKey:[jobId stringValue]];

NSMutableDictionary* result = [[NSMutableDictionary alloc] initWithDictionary: @{@"jobId": jobId,
@"body": body}];
Expand All @@ -570,6 +571,7 @@ + (BOOL)requiresMainQueueSetup
};

params.errorCallback = ^(NSError* error) {
[self.uploaders removeObjectForKey:[jobId stringValue]];
return [self reject:reject withError:error];
};

Expand Down

0 comments on commit 8468d43

Please sign in to comment.