8228578: fix CFData object leak in macosx KeystoreImpl.m
authormbaesken
Wed, 24 Jul 2019 12:36:12 +0200
changeset 57541 5da01706bf11
parent 57540 dd6d424909dc
child 57542 db740ced41c4
8228578: fix CFData object leak in macosx KeystoreImpl.m Reviewed-by: weijun
src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m
--- a/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m	Fri Jul 26 09:06:03 2019 +0200
+++ b/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m	Wed Jul 24 12:36:12 2019 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -562,6 +562,9 @@
 
     err = SecKeychainItemImport(cfDataToImport, NULL, &dataFormat, NULL,
                                 0, &paramBlock, defaultKeychain, &createdItems);
+    if (cfDataToImport != NULL) {
+        CFRelease(cfDataToImport);
+    }
 
     if (err == noErr) {
         SecKeychainItemRef anItem = (SecKeychainItemRef)CFArrayGetValueAtIndex(createdItems, 0);