+2001-11-19 Ezra Peisach <epeisach@mit.edu>
+
+ * t_kdb.c (do_testing): Invoke krb5_free_principal and
+ krb5_free_keyblock_contents on master key to prevent minor memory
+ leak.
+
2001-10-30 Ezra Peisach <epeisach@mit.edu>
* kdb_cpw.c (cleanup_key_data): Do not free NULL pointer.
krb5_context kcontext;
char *op, *linkage, *oparg;
krb5_principal master_princ;
+ int master_princ_set = 0;
char *mkey_name;
char *realm;
char *mkey_fullname;
oparg = "";
crflags = hash ? KRB5_KDB_CREATE_HASH : KRB5_KDB_CREATE_BTREE;
+ memset(&master_keyblock, 0, sizeof(master_keyblock));
+
/* Set up some initial context */
op = "initializing krb5";
kret = krb5_init_context(&kcontext);
&mkey_fullname, &master_princ)))
goto goodbye;
+ master_princ_set = 1;
if (verbose)
fprintf(stdout, "%s: Initializing '%s', master key is '%s'\n",
programname, db, mkey_fullname);
+ free(mkey_fullname);
+ mkey_fullname = 0;
+
op = "salting master key";
if ((kret = krb5_principal2salt(kcontext, master_princ, &salt_data)))
goto goodbye;
}
goodbye:
+ if(master_princ_set) {
+ krb5_free_principal(kcontext, master_princ);
+ }
if (kret)
fprintf(stderr, "%s: error while %s %s%s(%s)\n",
programname, op, linkage, oparg, error_message(kret));
}
}
+ krb5_free_keyblock_contents(kcontext, &master_keyblock);
krb5_free_context(kcontext);
return((kret) ? 1 : 0);