fixed an apparent memory leak in krb5_dbm_db_get_principal();
authorDonald Davis <don@mit.edu>
Fri, 2 Nov 1990 21:20:48 +0000 (21:20 +0000)
committerDonald Davis <don@mit.edu>
Fri, 2 Nov 1990 21:20:48 +0000 (21:20 +0000)
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

src/lib/kdb/kdb_dbm.c

index 6044e0c85db9b29c57d6576ab7ea30b3b23e3222..a89339b83c58e492b661195a2d3dc879fc827dc5 100644 (file)
@@ -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)