krb5_free_principal() doesn't free the realm krb5_princ_set_realm() doesn't free the old realm, if one exists.