Fix a few memory leaks. send-pr:20061030 Index: src/kdc/kdc_preauth.c =================================================================== --- src/kdc/kdc_preauth.c (revision 18750) +++ src/kdc/kdc_preauth.c (working copy) @@ -349,6 +352,7 @@ * leave room for a terminator entry. */ preauth_systems = malloc(sizeof(krb5_preauth_systems) * (module_count + 1)); if (preauth_systems == NULL) { + krb5int_free_plugin_dir_data(preauth_plugins_ftables); return ENOMEM; } @@ -414,6 +418,7 @@ } } } + krb5int_free_plugin_dir_data(preauth_plugins_ftables); n_preauth_systems = k; /* Add the end-of-list marker. */ preauth_systems[k].name = "[end]"; Index: src/lib/crypto/string_to_key.c =================================================================== --- src/lib/crypto/string_to_key.c (revision 18750) +++ src/lib/crypto/string_to_key.c (working copy) @@ -93,6 +93,7 @@ if (ret) { memset(key->contents, 0, keylength); free(key->contents); + key->contents = NULL; } return(ret); Index: src/lib/krb5/krb/preauth2.c =================================================================== --- src/lib/krb5/krb/preauth2.c (revision 18750) +++ src/lib/krb5/krb/preauth2.c (working copy) @@ -167,11 +167,13 @@ /* allocate the space we need */ context = malloc(sizeof(*context)); if (context == NULL) { + krb5int_free_plugin_dir_data(tables); return; } context->modules = malloc(sizeof(context->modules[0]) * n_modules); if (context->modules == NULL) { free(context); + krb5int_free_plugin_dir_data(tables); return; } memset(context->modules, 0, sizeof(context->modules[0]) * n_modules); @@ -216,6 +219,7 @@ } } + krb5int_free_plugin_dir_data(tables); /* return the result */ *preauth_context = context; }