Minor cleanup/future-proofing for pg_saslprep().
authorTom Lane
Sat, 8 Sep 2018 22:20:36 +0000 (18:20 -0400)
committerTom Lane
Sat, 8 Sep 2018 22:20:36 +0000 (18:20 -0400)
commit930b785d40cf53d679c72ffc2c34a63d412bee5b
tree16a1c2346e235ff05ae77a273ba56e3fe680df19
parent3985b75dca6d1101cc4cb6e78456dc6c5f72fcac
Minor cleanup/future-proofing for pg_saslprep().

Ensure that pg_saslprep() initializes its output argument to NULL in
all failure paths, and then remove the redundant initialization that
some (not all) of its callers did.  This does not fix any live bug,
but it reduces the odds of future bugs of omission.

Also add a comment about why the existing failure-path coding is
adequate.

Back-patch so as to keep the function's API consistent across branches,
again to forestall future bug introduction.

Patch by me, reviewed by Michael Paquier

Discussion: https://postgr.es/m/16558.1536407783@sss.pgh.pa.us
src/backend/libpq/auth-scram.c
src/common/saslprep.c
src/interfaces/libpq/fe-auth-scram.c