Memory leak in new memory keytab
authorEzra Peisach <epeisach@mit.edu>
Sat, 3 Feb 2007 18:09:56 +0000 (18:09 +0000)
committerEzra Peisach <epeisach@mit.edu>
Sat, 3 Feb 2007 18:09:56 +0000 (18:09 +0000)
The memory keytab introduced in ticket 5411 suffers from a memory leak
in the Heimdal compatible kt_close() handling and thread destructor in which
the cursor->entry is not freed.

ticket: new

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19138 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/keytab/kt_memory.c

index f30c7d7b5a443c92edbd7d64b84870eb47ab5712..5e550d4929c22fdcb58d40f102b6133b77e3cd7b 100644 (file)
@@ -175,6 +175,7 @@ void krb5int_mkt_finalize(void) {
             * krb5_context since we know that the context isn't used by\r
             * krb5_kt_free_entry or krb5_free_principal. */\r
            krb5_kt_free_entry(NULL, cursor->entry);\r
+           krb5_xfree(cursor->entry);\r
            krb5_xfree(cursor);\r
        }\r
 \r
@@ -354,6 +355,7 @@ krb5_mkt_close(krb5_context context, krb5_keytab id)
            next_cursor = cursor->next;\r
 \r
            krb5_kt_free_entry(context, cursor->entry);\r
+           krb5_xfree(cursor->entry);\r
            krb5_xfree(cursor);\r
        }\r
 \r