snacktime wrote:
> I forgot to mention.  The c extension only fails when I pass bad
> credentials and the call to krb5_get_init_creds_password fails.  Also,
> the extension code is the same as the C code generated by RubyInline
> except for the Init_ definition.

Unfortunately, it is difficult to say without knowing mroe about krb5's
interface.  Also, note that just because commenting a particular line
seems to fix the problem does not necessarilly mean that the problem is
caused by that line.  By the same token, your inline version could have
the same bug, but for whatever reason, it is not manifesting itself.

That being said, I did see one thing that looks a little suspiscious.
When name parsing fails, it looks like everything gets cleaned up, but
then the function continues on to password parsing.  If both name
parsing and password parsing fail, then everything gets cleaned up
twice.

If this is indeed the problem, then one solution is to return before
the name parsing if-block closes.  You could add the following line at
the end of the name parsing if-block:

return INT2FIX(ret);