krb5 commit: Fix minor leak in gssrpc UDP cache code

Greg Hudson ghudson at mit.edu
Wed Jun 20 11:35:01 EDT 2018


https://github.com/krb5/krb5/commit/909c655a9fa38102cfc9864757a33173388146ba
commit 909c655a9fa38102cfc9864757a33173388146ba
Author: Greg Hudson <ghudson at mit.edu>
Date:   Tue Jun 19 13:15:15 2018 -0400

    Fix minor leak in gssrpc UDP cache code
    
    In svc_udp.c:cache_set(), if victim is allocated successfully but
    allocation for newbuf fails, free victim before returning.  Reported
    by Bean Zhang.
    
    ticket: 8703

 src/lib/rpc/svc_udp.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/lib/rpc/svc_udp.c b/src/lib/rpc/svc_udp.c
index d3140df..8ecbdf2 100644
--- a/src/lib/rpc/svc_udp.c
+++ b/src/lib/rpc/svc_udp.c
@@ -479,6 +479,7 @@ cache_set(
 		newbuf = mem_alloc(su->su_iosz);
 		if (newbuf == NULL) {
 			CACHE_PERROR("cache_set: could not allocate new rpc_buffer");
+			free(victim);
 			return;
 		}
 	}


More information about the cvs-krb5 mailing list