Skip to content

Commit

Permalink
Fix leaks caused by mismatch of CFRelease/CFRetain with SecItemCopyMa…
Browse files Browse the repository at this point in the history
…tching
  • Loading branch information
Therzok authored Jul 12, 2022
1 parent f0845bd commit 07fce44
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ static int32_t EnumerateKeychain(CFStringRef matchType, CFArrayRef* pCertsOut)
assert(result == NULL);
status = noErr;
}
else

if (result != NULL)
{
if (result != NULL)
{
CFRelease(result);
}
CFRelease(result);
}

return status;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,11 @@ static bool IsCertInKeychain(CFTypeRef needle, SecKeychainRef haystack)
{
ret = false;
}

if (result != NULL)
{
CFRelease(result);
}

CFRelease(itemMatch);
CFRelease(searchList);
Expand Down

0 comments on commit 07fce44

Please sign in to comment.