From: Greg Hudson Date: Tue, 21 Jun 2016 22:46:28 +0000 (-0400) Subject: Fix recent memory leak in locate_kdc.c X-Git-Tag: krb5-1.15-beta1~161 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F473%2Fhead;p=thirdparty%2Fkrb5.git Fix recent memory leak in locate_kdc.c Commit ce112dec844e4650b5ad174bd40f21c32aebe1d1 introduced a memory leak in locate_srv_conf_1() by moving the free(realmstr) call to the cleanup handler, because there was an early return after realmstr is allocated. Convert that early return to a goto. --- diff --git a/src/lib/krb5/os/locate_kdc.c b/src/lib/krb5/os/locate_kdc.c index cd48627f77..6d4416c996 100644 --- a/src/lib/krb5/os/locate_kdc.c +++ b/src/lib/krb5/os/locate_kdc.c @@ -240,7 +240,7 @@ locate_srv_conf_1(krb5_context context, const krb5_data *realm, error_message(code)); if (code == PROF_NO_SECTION || code == PROF_NO_RELATION) code = 0; - return code; + goto cleanup; } for (i=0; hostlist[i]; i++) {