* t_ser.c (ser_keytab_test): Cleanup memory leak of forgetting to
authorEzra Peisach <epeisach@mit.edu>
Mon, 24 May 2004 20:24:23 +0000 (20:24 +0000)
committerEzra Peisach <epeisach@mit.edu>
Mon, 24 May 2004 20:24:23 +0000 (20:24 +0000)
close keytab.

* chpw.c: Add parenthesis around assignments in conditionals.

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

src/lib/krb5/krb/ChangeLog
src/lib/krb5/krb/chpw.c
src/lib/krb5/krb/t_ser.c

index 736eeba80b307064204a6e199499f06ae215873c..3bc26d062d195f83ce007a210a04bfa15e9c4cf5 100644 (file)
@@ -1,3 +1,10 @@
+2004-05-24  Ezra Peisach  <epeisach@mit.edu>
+
+       * t_ser.c (ser_keytab_test): Cleanup memory leak of forgetting to
+       close keytab.
+
+       * chpw.c: Add parenthesis around assignments in conditionals.
+
 2004-05-12  Jeffrey Altman <jaltman@mit.edu>
 
     * send_tgs.c: krb5_send_tgs() was broken in the case of a KRB_ERROR
index a455cc40b8c0c87cddfbf630f3fb4862f8c75453..640124601e18df54053857e30c9c90ab99c734a0 100644 (file)
@@ -249,13 +249,12 @@ krb5int_mk_setpw_req(
     krb5_data  *encoded_setpw;
 
     char *ptr;
-     int count = 2;
 
      cipherpw.data = NULL;
      cipherpw.length = 0;
      
-    if (ret = krb5_auth_con_setflags(context, auth_context,
-                                    KRB5_AUTH_CONTEXT_DO_SEQUENCE))
+    if ((ret = krb5_auth_con_setflags(context, auth_context,
+                                     KRB5_AUTH_CONTEXT_DO_SEQUENCE)))
                return(ret);
 
     ret = encode_krb5_setpw_req(targprinc, passwd, &encoded_setpw);
@@ -318,7 +317,6 @@ krb5int_rd_setpw_rep( krb5_context context, krb5_auth_context auth_context, krb5
     krb5_error_code ret;
     krb5_data cipherresult;
     krb5_data clearresult;
-    krb5_replay_data replay;
     krb5_keyblock *tmpkey;
 /*
 ** validate the packet length -
@@ -333,10 +331,10 @@ krb5int_rd_setpw_rep( krb5_context context, krb5_auth_context auth_context, krb5
 */
     if (krb5_is_krb_error(packet)) {
        krb5_error *krberror;
-       if (ret = krb5_rd_error(context, packet, &krberror))
+       if ((ret = krb5_rd_error(context, packet, &krberror)))
            return(ret);
        if (krberror->e_data.data  == NULL) {
-           ret = ERROR_TABLE_BASE_krb5 + krberror->error;
+           ret = ERROR_TABLE_BASE_krb5 + (krb5_error_code) krberror->error;
            krb5_free_error(context, krberror);
            return (ret);
        }
index 37d79dacdd201abd0a1774175058c8cdbb6d39cb..61c6e47979fdf1597055585037e6f45cccf59c69 100644 (file)
@@ -439,6 +439,8 @@ ser_keytab_test(krb5_context kcontext, int verbose)
            sprintf(ccname, "WRFILE:temp_kt_%d", (int) getpid());
            if ((kret = krb5_kt_resolve(kcontext, ccname, &keytab)))
                kret = krb5_kt_register(kcontext, &krb5_ktf_writable_ops);
+           else
+               kret = krb5_kt_close(kcontext, keytab);
            if (!kret &&
                !(kret = krb5_kt_resolve(kcontext, ccname, &keytab)) &&
                !(kret = ser_data(verbose, "> Resolved WRFILE keytab",