No, you can't. The filesystems sys_faccessat() then invokes are entitled to
take a reference to it - the SunRPC authentication stuff, for example - so you
can't just preemptively unallocate it as would occur with an automatic variable.
A better way would be to compare fsuid/fsgid to uid/gid and to just take an
extra ref on the incumbent cred object if they're the same, rather than always
allocating a new one. That, I suspect, would speed up 99.99% of the cases.
David
-