plug memory leak
authorJohn Kohl <jtkohl@mit.edu>
Thu, 21 Feb 1991 15:48:40 +0000 (15:48 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Thu, 21 Feb 1991 15:48:40 +0000 (15:48 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1758 dc483132-0cff-0310-8789-dd5450dbe970

src/kdc/kdc_util.c
src/lib/krb5/asn.1/cvt_flags.c

index 96a3c70065366656866c78118b6dddb2aa79be83..9d210e725fdab282200f69257e74c626881d795c 100644 (file)
@@ -257,7 +257,7 @@ krb5_ticket **ticket;
                            &our_cksum)) {
        krb5_free_tkt_authent(authdat);
        xfree(our_cksum.contents);
-       xfree(scratch->data);
+       krb5_free_data(scratch);
        cleanup_apreq();
        return retval;
     }
@@ -267,11 +267,11 @@ krb5_ticket **ticket;
               our_cksum.length)) {
        krb5_free_tkt_authent(authdat);
        xfree(our_cksum.contents);
-       xfree(scratch->data);
+       krb5_free_data(scratch);
        cleanup_apreq();
        return KRB5KRB_AP_ERR_BAD_INTEGRITY; /* XXX wrong code? */
     }
-    xfree(scratch->data);
+    krb5_free_data(scratch);
     xfree(our_cksum.contents);
 
     krb5_free_tkt_authent(authdat);
index cf8e468b7f5b228faf529f8189a72cce32b033fb..1d04dc122e59607e84cd775f6779a66893c8bfc4 100644 (file)
@@ -76,12 +76,14 @@ register int *error;
        (swbits[(val >> 16) & 0xff] << 8) | swbits[(val >> 24) & 0xff];
     
     tmp = int2strb(useval, 32);                /* XXX hardcode 32 bits */
-    
+    /* tmp points to static buffer */
+
     pe = strb2bitstr(tmp, 32, PE_CLASS_UNIV, PE_PRIM_BITS);
     if (!pe)
        *error = ENOMEM;
     else
        *error = 0;
+
     return(pe);
 }
 
@@ -104,6 +106,8 @@ register int *error;
     
     result = strb2int(tmp, length);
 
+    free(tmp);
+
     /* need to reverse bits in result, so that 0 is msb */
     result = (swbits[(result & 0xff)] << 24) |
             (swbits[(result >> 8) & 0xff] << 16) |