rxgk: Avoid calling xdr_destroy on blank xdrs 21/13521/4
authorAndrew Deason <adeason@sinenomine.net>
Tue, 12 Mar 2019 22:03:09 +0000 (17:03 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Sat, 23 Mar 2019 22:50:03 +0000 (18:50 -0400)
commitae9b90170ffa02f7b65339b3c138709362f27d69
treeead135b9a14fb23063288487172b66e37f6ddb64
parentaa6661f653d86d4e792587eefbc37705b68e5137
rxgk: Avoid calling xdr_destroy on blank xdrs

A couple of callers in rxgk_token.c call xdr_destroy(&xdrs) in a
cleanup code path; at present the code is fine because we are careful to
only jump to the cleanup path from a state where the xdrs are initialized,
but this is needlessly fragile (and is an undocumented requirement of the
code).  Since xdr_destroy() unconditionally looks at xdrs.x_ops->x_destroy,
this could cause a NULL dereference if an error is encountered in a future
version where the 'xdrs' may be zeroed when the cleanup path runs.

Change-Id: I23c1bd09c88238bc602cc92572df4cd2278c69c9
Reviewed-on: https://gerrit.openafs.org/13521
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/rxgk/rxgk_token.c