plug memory leaks
authorJohn Kohl <jtkohl@mit.edu>
Thu, 21 Feb 1991 16:37:42 +0000 (16:37 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Thu, 21 Feb 1991 16:37:42 +0000 (16:37 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1762 dc483132-0cff-0310-8789-dd5450dbe970

src/kdc/do_as_req.c
src/kdc/do_tgs_req.c

index a5d59b42819b5ea560424b09d649fa74f7dbe4bd..7784c1ff5c7f6fd661ab895a6632ca825335523e 100644 (file)
@@ -153,11 +153,7 @@ krb5_data **response;                      /* filled in with a response packet */
 #undef cleanup
 #define cleanup() {krb5_db_free_principal(&client, 1); \
                   krb5_db_free_principal(&server, 1); \
-                  memset((char *)session_key->contents, 0, \
-                         session_key->length); \
-                  xfree(session_key->contents); \
-                  session_key->contents = 0; }
-
+                  krb5_free_keyblock(session_key); }
 
     ticket_reply.server = request->server;
     ticket_reply.enc_part.etype = useetype;
@@ -261,10 +257,7 @@ krb5_data **response;                      /* filled in with a response packet */
 
 #undef cleanup
 #define cleanup() {krb5_db_free_principal(&client, 1); \
-                  memset((char *)session_key->contents, 0, \
-                         session_key->length); \
-                  xfree(session_key->contents); \
-                  session_key->contents = 0; \
+                  krb5_free_keyblock(session_key); \
                   memset(ticket_reply.enc_part.ciphertext.data, 0, \
                         ticket_reply.enc_part.ciphertext.length); \
                   free(ticket_reply.enc_part.ciphertext.data);}
@@ -312,10 +305,7 @@ krb5_data **response;                      /* filled in with a response packet */
 
 #undef cleanup
 #define cleanup() {krb5_db_free_principal(&client, 1); \
-                  memset((char *)session_key->contents, 0, \
-                         session_key->length); \
-                  xfree(session_key->contents); \
-                  session_key->contents = 0; \
+                  krb5_free_keyblock(session_key); \
                   memset(ticket_reply.enc_part.ciphertext.data, 0, \
                         ticket_reply.enc_part.ciphertext.length); \
                   free(ticket_reply.enc_part.ciphertext.data); \
index 66d3b91fca46fa1d5bf960f6511ecb43f5ac1585..c46a400ee452a9634316f0a1d26e83d4aa9e3416 100644 (file)
@@ -182,10 +182,7 @@ tgt_again:
 
 #undef cleanup
 #define cleanup() { krb5_db_free_principal(&server, 1); \
-                  memset((char *)session_key->contents, 0, \
-                         session_key->length); \
-                  xfree(session_key->contents); \
-                  session_key->contents = 0; }
+                  krb5_free_keyblock(session_key);}
 
     ticket_reply.server = request->server; /* XXX careful for realm... */
     ticket_reply.enc_part.etype = useetype;
@@ -448,10 +445,7 @@ tgt_again:
     }
 #undef cleanup
 #define cleanup() { krb5_db_free_principal(&server, 1); \
-                  memset((char *)session_key->contents, 0, \
-                         session_key->length); \
-                  xfree(session_key->contents); \
-                  session_key->contents = 0; \
+                  krb5_free_keyblock(session_key); \
                   if (newtransited) free(enc_tkt_reply.transited.tr_contents.data);}
 
     ticket_reply.enc_part2 = &enc_tkt_reply;
@@ -524,10 +518,8 @@ tgt_again:
     retval = krb5_encode_kdc_rep(KRB5_TGS_REP, &reply_encpart,
                                 header_ticket->enc_part2->session,
                                 &reply, response);
-    memset((char *)session_key->contents, 0, session_key->length);
-    xfree(session_key->contents);
+    krb5_free_keyblock(session_key);
     tkt_cleanup();
-    session_key->contents = 0;
     memset(ticket_reply.enc_part.ciphertext.data, 0,
           ticket_reply.enc_part.ciphertext.length);
     free(ticket_reply.enc_part.ciphertext.data);