kim_preferences should free old identity before overwriting
authorAlexandra Ellwood <lxs@mit.edu>
Tue, 21 Oct 2008 21:52:29 +0000 (21:52 +0000)
committerAlexandra Ellwood <lxs@mit.edu>
Tue, 21 Oct 2008 21:52:29 +0000 (21:52 +0000)
ticket: new

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20904 dc483132-0cff-0310-8789-dd5450dbe970

src/kim/lib/kim_preferences.c

index d63a6141d5fddf625401ed6278c77ddceb9e4e38..a9bd6ce5595b465bb600cc496be355e5633e9fa1 100644 (file)
@@ -437,16 +437,24 @@ static kim_error kim_preferences_read (kim_preferences in_preferences)
     
     if (!err) {
         kim_identity default_identity = kim_default_client_identity;
+        kim_identity identity = NULL;
         
         err = kim_os_identity_create_for_username (&default_identity);
         
         if (!err) {
             err = kim_os_preferences_get_identity_for_key (kim_preference_key_client_identity,
                                                            default_identity,
-                                                           &in_preferences->client_identity);
+                                                           &identity);
+        }
+        
+        if (!err) {
+            kim_identity_free (&in_preferences->client_identity);
+            in_preferences->client_identity = identity;
+            identity = NULL;
         }
         
         kim_identity_free (&default_identity);
+        kim_identity_free (&identity);
     }
     
     if (!err) {