[27879] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Fix leak in krb5_krcc_unparse_cred on error

daemon@ATHENA.MIT.EDU (Greg Hudson)
Fri Aug 2 12:14:29 2013

Date: Fri, 2 Aug 2013 12:14:16 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201308021614.r72GEGCj020234@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/40d8ad25e2160583c6d74a10e7599253d3b292ce
commit 40d8ad25e2160583c6d74a10e7599253d3b292ce
Author: Greg Hudson <ghudson@mit.edu>
Date:   Fri Aug 2 11:37:40 2013 -0400

    Fix leak in krb5_krcc_unparse_cred on error
    
    Based on a patch from simo@redhat.com.

 src/lib/krb5/ccache/cc_keyring.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/lib/krb5/ccache/cc_keyring.c b/src/lib/krb5/ccache/cc_keyring.c
index 3828c59..55c7711 100644
--- a/src/lib/krb5/ccache/cc_keyring.c
+++ b/src/lib/krb5/ccache/cc_keyring.c
@@ -1913,7 +1913,7 @@ krb5_krcc_unparse_cred(krb5_context context, krb5_ccache id,
                        krb5_creds * creds, char **datapp, unsigned int *lenptr)
 {
     krb5_error_code kret;
-    char   *buf;
+    char *buf = NULL;
     krb5_krcc_bc bc;
 
     if (!creds || !datapp || !lenptr)
@@ -1963,9 +1963,11 @@ krb5_krcc_unparse_cred(krb5_context context, krb5_ccache id,
     /* Success! */
     *datapp = buf;
     *lenptr = bc.bpp - buf;
+    buf = NULL;
     kret = KRB5_OK;
 
 errout:
+    free(buf);
     return kret;
 }
 
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post