From: John Kohl <jtkohl@mit.edu>
Date: Thu, 21 Feb 1991 15:48:40 +0000 (+0000)
Subject: plug memory leak
X-Git-Tag: krb5-1.0-alpha4~214
X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=72d8b86df4114386fe4c24312608395a57292772;p=krb5.git

plug memory leak

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

diff --git a/src/kdc/kdc_util.c b/src/kdc/kdc_util.c
index 96a3c7006..9d210e725 100644
--- a/src/kdc/kdc_util.c
+++ b/src/kdc/kdc_util.c
@@ -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);
diff --git a/src/lib/krb5/asn.1/cvt_flags.c b/src/lib/krb5/asn.1/cvt_flags.c
index cf8e468b7..1d04dc122 100644
--- a/src/lib/krb5/asn.1/cvt_flags.c
+++ b/src/lib/krb5/asn.1/cvt_flags.c
@@ -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) |