changeset 55703:6bb46e2777ab

8217563: Improve realm maintenance Reviewed-by: mullan, mschoene, valeriep
author weijun
date Wed, 30 Jan 2019 10:51:50 +0800
parents 339e544d59e3
children 04cccf60fe44
files src/java.security.jgss/macosx/native/libosxkrb5/SCDynamicStoreConfig.m
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.security.jgss/macosx/native/libosxkrb5/SCDynamicStoreConfig.m	Wed Jan 23 14:45:54 2019 -0800
+++ b/src/java.security.jgss/macosx/native/libosxkrb5/SCDynamicStoreConfig.m	Wed Jan 30 10:51:50 2019 +0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2012, 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;
         }