Skip to content

Commit

Permalink
Fixed memory leak during buffered extraction from Swift caller (Issue #…
Browse files Browse the repository at this point in the history
  • Loading branch information
abbeycode committed Oct 18, 2018
1 parent c83f3f6 commit 2ee3a1c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Classes/URKArchive.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1162,12 +1162,14 @@ int CALLBACK BufferedReadCallbackProc(UINT msg, long UserData, long P1, long P2)
BOOL (^bufferedReadBlock)(NSData*) = (__bridge BOOL(^)(NSData*))(void *)UserData;

if (msg == UCM_PROCESSDATA) {
URKLogDebug("msg: UCM_PROCESSDATA; Copying data chunk and calling read block");
NSData *dataChunk = [NSData dataWithBytes:(UInt8 *)P1 length:P2];
BOOL cancelRequested = !bufferedReadBlock(dataChunk);

if (cancelRequested) {
return -1;
@autoreleasepool {
URKLogDebug("msg: UCM_PROCESSDATA; Copying data chunk and calling read block");
NSData *dataChunk = [NSData dataWithBytes:(UInt8 *)P1 length:P2];
BOOL cancelRequested = !bufferedReadBlock(dataChunk);

if (cancelRequested) {
return -1;
}
}
}

Expand Down

0 comments on commit 2ee3a1c

Please sign in to comment.