changeset 13599:2a567237233b

8217563: Improve realm maintenance Reviewed-by: mullan, mschoene, valeriep
author igerasim
date Tue, 19 Mar 2019 14:16:20 -0700
parents dacc6a3dd712
children 9729eee8ef6a
files src/macosx/native/java/util/SCDynamicStoreConfig.m
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/macosx/native/java/util/SCDynamicStoreConfig.m	Thu Feb 07 08:47:10 2019 -0500
+++ b/src/macosx/native/java/util/SCDynamicStoreConfig.m	Tue Mar 19 14:16:20 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, 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
@@ -102,7 +102,8 @@
     for (NSString *realm in realms) {
         CFTypeRef realmInfo = SCDynamicStoreCopyValue(store, (CFStringRef) [NSString stringWithFormat:@"Kerberos:%@", realm]);
 
-        if (CFGetTypeID(realmInfo) != CFDictionaryGetTypeID()) {
+        if (realmInfo == NULL || CFGetTypeID(realmInfo) != CFDictionaryGetTypeID()) {
+            if (realmInfo) CFRelease(realmInfo);
             return nil;
         }