clean up memory leak and potential unused variable in crypto tests
authorEzra Peisach <epeisach@mit.edu>
Fri, 3 Sep 2010 02:43:21 +0000 (02:43 +0000)
committerEzra Peisach <epeisach@mit.edu>
Fri, 3 Sep 2010 02:43:21 +0000 (02:43 +0000)
t_prf.c:  Ensure prfsz is set before use (not exercised in current tests)

t_short.c: Fix memory leak

ticket: 6769

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

src/lib/crypto/crypto_tests/t_prf.c
src/lib/crypto/crypto_tests/t_short.c

index 6336d8651ef526b8ca9e309cfb96070719724822..d9ac3d8b9016e1d495b5345db50a7c77abde0755 100644 (file)
@@ -75,7 +75,10 @@ int main () {
 
             free (input.data);
             input.data = NULL;
+        } else {
+            prfsz = 0;
         }
+
         for (; prfsz > 0; prfsz--) {
             printf ("%02x",
                     (unsigned int) ((unsigned char ) output.data[output.length-prfsz]));
index 9ddfd5e3d3140f1acc75f27ecd8481ee730e1ea4..90f15b8a88aff5ea318b64f78317e40fd831ac6e 100644 (file)
@@ -109,6 +109,8 @@ test_enctype(krb5_enctype enctype)
         free(input.ciphertext.data);
         free(output.data);
     }
+    krb5int_c_free_keyblock_contents (NULL, &keyblock);
+
 }
 
 int