* conv_princ.c (krb5_425_conv_principal): Call profile_free_list
authorEzra Peisach <epeisach@mit.edu>
Tue, 26 Sep 2000 17:01:58 +0000 (17:01 +0000)
committerEzra Peisach <epeisach@mit.edu>
Tue, 26 Sep 2000 17:01:58 +0000 (17:01 +0000)
        on v4realms during the iteration loop. Do not call
        profile_release_string with a NULL pointer.

Fixes a memory leak.

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

src/lib/krb5/krb/ChangeLog
src/lib/krb5/krb/conv_princ.c

index 014042b1cdf177956b56c88ab94c0e8156e48912..b6a5bc4aef696bec4588ad0b77c965110d74d896 100644 (file)
@@ -1,3 +1,9 @@
+Tue Sep 26 13:00:54 2000  Ezra Peisach  <epeisach@mit.edu>
+
+       * conv_princ.c (krb5_425_conv_principal): Call profile_free_list
+       on v4realms during the iteration loop. Do not call
+       profile_release_string with a NULL pointer.
+
 2000-09-25  Ezra Peisach  <epeisach@mit.edu>
 
        * t_kerb.c: Add prototypes for test functions.
index f0d3d3d31e42a7af1fd85c7629b599caa91e8438..c880de3eb43fcccb32a45ce70d86e246e6efcbb6 100644 (file)
@@ -272,6 +272,10 @@ krb5_425_conv_principal(context, name, instance, realm, princ)
        } else if ((retval == 0) && (realm_name == NULL)) {
                break;
        }
+       if (v4realms != NULL) {
+               profile_free_list(v4realms);
+               v4realms = NULL;
+       }
        if (realm_name != NULL) {
                profile_release_string (realm_name);
                realm_name = NULL;
@@ -327,10 +331,10 @@ krb5_425_conv_principal(context, name, instance, realm, princ)
 not_service:   
      retval = krb5_build_principal(context, princ, strlen(realm), realm, name,
                                   instance, 0);
-     profile_iterator_free (&iterator);
-     profile_free_list(full_name);
-     profile_free_list(v4realms);
-     profile_release_string (realm_name);
-     profile_release_string (dummy_value);
+     if (iterator) profile_iterator_free (&iterator);
+     if (full_name) profile_free_list(full_name);
+     if (v4realms) profile_free_list(v4realms);
+     if (realm_name) profile_release_string (realm_name);
+     if (dummy_value) profile_release_string (dummy_value);
      return retval;
 }