svn rev #21950: trunk/src/lib/krb5/ccache/
ghudson@MIT.EDU
ghudson at MIT.EDU
Tue Feb 10 12:17:41 EST 2009
http://src.mit.edu/fisheye/changelog/krb5/?cs=21950
Commit By: ghudson
Log Message:
Fix a memory leak (unlikely to happen in practice) in krb5_mcc_store;
use a cleanup handler for robustness.
Changed Files:
U trunk/src/lib/krb5/ccache/cc_memory.c
Modified: trunk/src/lib/krb5/ccache/cc_memory.c
===================================================================
--- trunk/src/lib/krb5/ccache/cc_memory.c 2009-02-10 16:37:59 UTC (rev 21949)
+++ trunk/src/lib/krb5/ccache/cc_memory.c 2009-02-10 17:17:39 UTC (rev 21950)
@@ -643,18 +643,19 @@
if (new_node == NULL)
return ENOMEM;
err = krb5_copy_creds(ctx, creds, &new_node->creds);
- if (err) {
- free(new_node);
- return err;
- }
+ if (err)
+ goto cleanup;
err = k5_cc_mutex_lock(ctx, &mptr->lock);
if (err)
- return err;
+ goto cleanup;
new_node->next = mptr->link;
mptr->link = new_node;
update_mcc_change_time(mptr);
k5_cc_mutex_unlock(ctx, &mptr->lock);
return 0;
+cleanup:
+ free(new_node);
+ return err;
}
static krb5_error_code KRB5_CALLCONV
More information about the cvs-krb5
mailing list