The most recent change could leak memory when trying to parse an
invalid principal because of a failure to use the cleanup handler.
} else if (*p == '@' && (!enterprise || !first_at)) {
/* Realm separator. In enterprise principals, the first one of
* these we see is part of the component. */
- if (cur_data == &princ->realm)
- return KRB5_PARSE_MALFORMED;
+ if (cur_data == &princ->realm) {
+ ret = KRB5_PARSE_MALFORMED;
+ goto cleanup;
+ }
cur_data = &princ->realm;
} else {
/* Component or realm character, possibly quoted. Make note if