Make sure the ticket_info array is freed, not just its contents; and test
authorTheodore Tso <tytso@mit.edu>
Wed, 1 Dec 1993 21:56:08 +0000 (21:56 +0000)
committerTheodore Tso <tytso@mit.edu>
Wed, 1 Dec 1993 21:56:08 +0000 (21:56 +0000)
to make sure ticket_info is set before trying to free it and its contents.

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

src/lib/krb5/free/f_cred_enc.c

index 5ca6102d0338ab54ff724058e18695307af1011a..e9091290c48212f4ff2591ec4d1fd9697fd51378 100644 (file)
@@ -44,16 +44,19 @@ register krb5_cred_enc_part *val;
     if (val->s_address)
       krb5_free_address(val->s_address);
 
-    for (temp = val->ticket_info; *temp; temp++) {
-       if ((*temp)->session)
-         krb5_free_keyblock((*temp)->session);
-       if ((*temp)->client)
-         krb5_free_principal((*temp)->client);
-       if ((*temp)->server)
-         krb5_free_principal((*temp)->server);
-       if ((*temp)->caddrs)
-         krb5_free_addresses((*temp)->caddrs);
-       krb5_xfree((*temp));
+    if (val->ticket_info) {
+       for (temp = val->ticket_info; *temp; temp++) {
+           if ((*temp)->session)
+               krb5_free_keyblock((*temp)->session);
+           if ((*temp)->client)
+               krb5_free_principal((*temp)->client);
+           if ((*temp)->server)
+               krb5_free_principal((*temp)->server);
+           if ((*temp)->caddrs)
+               krb5_free_addresses((*temp)->caddrs);
+           krb5_xfree((*temp));
+       }
+       krb5_xfree(val->ticket_info);
     }
     krb5_xfree(val);
     return;