From: Donald Davis Date: Fri, 2 Nov 1990 21:20:48 +0000 (+0000) Subject: fixed an apparent memory leak in krb5_dbm_db_get_principal(); X-Git-Tag: krb5-1.0-alpha3~179 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=a00a34c00786b5663bffa26c306282ff89e20f56;p=krb5.git fixed an apparent memory leak in krb5_dbm_db_get_principal(); if the decode of the db contents failed, the search key's string never got freed, because the key's address is held in the stack. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1413 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/kdb/kdb_dbm.c b/src/lib/kdb/kdb_dbm.c index 6044e0c85..a89339b83 100644 --- a/src/lib/kdb/kdb_dbm.c +++ b/src/lib/kdb/kdb_dbm.c @@ -758,14 +758,14 @@ krb5_boolean *more; /* are there more? */ goto cleanup; contents = dbm_fetch(db, key); - if (contents.dptr == NULL) { - found = 0; - } else { - if (retval = decode_princ_contents(&contents, entries)) - goto cleanup; - found = 1; - } free_encode_princ_dbmkey(&key); + + if (contents.dptr == NULL) + found = 0; + else if (retval = decode_princ_contents(&contents, entries)) + goto cleanup; + else found = 1; + (void) dbm_close(db); (void) krb5_dbm_db_unlock(); /* unlock read lock */ if (krb5_dbm_db_end_read(transaction) == 0)