Skip to content

Commit 370b3a4

Browse files
committed
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.
1 parent c31b5d9 commit 370b3a4

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

contrib/pgcrypto/pgp-pgsql.c

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -575,35 +575,25 @@ decrypt_internal(int is_pubenc, int need_text, text *data,
575575
err = pgp_set_symkey(ctx, (uint8 *) VARDATA(key),
576576
VARSIZE(key) - VARHDRSZ);
577577

578-
/*
579-
* decrypt
580-
*/
578+
/* decrypt */
581579
if (err >= 0)
580+
{
582581
err = pgp_decrypt(ctx, src, dst);
583582

584-
/*
585-
* failed?
586-
*/
587-
if (err < 0)
588-
goto out;
589-
590-
if (ex.expect)
591-
check_expect(ctx, &ex);
583+
if (ex.expect)
584+
check_expect(ctx, &ex);
592585

593-
/* remember the setting */
594-
got_unicode = pgp_get_unicode_mode(ctx);
586+
/* remember the setting */
587+
got_unicode = pgp_get_unicode_mode(ctx);
588+
}
595589

596-
out:
597-
if (src)
598-
mbuf_free(src);
599-
if (ctx)
600-
pgp_free(ctx);
590+
mbuf_free(src);
591+
pgp_free(ctx);
601592

602593
if (err)
603594
{
604595
px_set_debug_handler(NULL);
605-
if (dst)
606-
mbuf_free(dst);
596+
mbuf_free(dst);
607597
ereport(ERROR,
608598
(errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
609599
errmsg("%s", px_strerror(err))));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy