aboutsummaryrefslogtreecommitdiff
path: root/contrib/pgcrypto/pgp-pgsql.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2015-02-04 08:41:35 -0500
committerRobert Haas <rhaas@postgresql.org>2015-02-04 08:46:32 -0500
commit370b3a4618c48cb44a1137f47cf1156836cf8a90 (patch)
tree38469dbdcc4c5d0dbb55831da027382ae6918b77 /contrib/pgcrypto/pgp-pgsql.c
parentc31b5d9ddf25d26dac5f5c215b8a5e8b3dfa37e6 (diff)
downloadpostgresql-370b3a4618c48cb44a1137f47cf1156836cf8a90.tar.gz
postgresql-370b3a4618c48cb44a1137f47cf1156836cf8a90.zip
pgcrypto: Code cleanup for decrypt_internal.
Remove some unnecessary null-tests, and replace a goto-label construct with an "if" block. Michael Paquier, reviewed by me.
Diffstat (limited to 'contrib/pgcrypto/pgp-pgsql.c')
-rw-r--r--contrib/pgcrypto/pgp-pgsql.c30
1 files changed, 10 insertions, 20 deletions
diff --git a/contrib/pgcrypto/pgp-pgsql.c b/contrib/pgcrypto/pgp-pgsql.c
index 1a0e710301c..d0da05cd13a 100644
--- a/contrib/pgcrypto/pgp-pgsql.c
+++ b/contrib/pgcrypto/pgp-pgsql.c
@@ -575,35 +575,25 @@ decrypt_internal(int is_pubenc, int need_text, text *data,
err = pgp_set_symkey(ctx, (uint8 *) VARDATA(key),
VARSIZE(key) - VARHDRSZ);
- /*
- * decrypt
- */
+ /* decrypt */
if (err >= 0)
+ {
err = pgp_decrypt(ctx, src, dst);
- /*
- * failed?
- */
- if (err < 0)
- goto out;
-
- if (ex.expect)
- check_expect(ctx, &ex);
+ if (ex.expect)
+ check_expect(ctx, &ex);
- /* remember the setting */
- got_unicode = pgp_get_unicode_mode(ctx);
+ /* remember the setting */
+ got_unicode = pgp_get_unicode_mode(ctx);
+ }
-out:
- if (src)
- mbuf_free(src);
- if (ctx)
- pgp_free(ctx);
+ mbuf_free(src);
+ pgp_free(ctx);
if (err)
{
px_set_debug_handler(NULL);
- if (dst)
- mbuf_free(dst);
+ mbuf_free(dst);
ereport(ERROR,
(errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
errmsg("%s", px_strerror(err))));