mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	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.
This commit is contained in:
		@@ -575,35 +575,25 @@ decrypt_internal(int is_pubenc, int need_text, text *data,
 | 
				
			|||||||
		err = pgp_set_symkey(ctx, (uint8 *) VARDATA(key),
 | 
							err = pgp_set_symkey(ctx, (uint8 *) VARDATA(key),
 | 
				
			||||||
							 VARSIZE(key) - VARHDRSZ);
 | 
												 VARSIZE(key) - VARHDRSZ);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
						/* decrypt */
 | 
				
			||||||
	 * decrypt
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	if (err >= 0)
 | 
						if (err >= 0)
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
		err = pgp_decrypt(ctx, src, dst);
 | 
							err = pgp_decrypt(ctx, src, dst);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/*
 | 
							if (ex.expect)
 | 
				
			||||||
	 * failed?
 | 
								check_expect(ctx, &ex);
 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	if (err < 0)
 | 
					 | 
				
			||||||
		goto out;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (ex.expect)
 | 
							/* remember the setting */
 | 
				
			||||||
		check_expect(ctx, &ex);
 | 
							got_unicode = pgp_get_unicode_mode(ctx);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* remember the setting */
 | 
						mbuf_free(src);
 | 
				
			||||||
	got_unicode = pgp_get_unicode_mode(ctx);
 | 
						pgp_free(ctx);
 | 
				
			||||||
 | 
					 | 
				
			||||||
out:
 | 
					 | 
				
			||||||
	if (src)
 | 
					 | 
				
			||||||
		mbuf_free(src);
 | 
					 | 
				
			||||||
	if (ctx)
 | 
					 | 
				
			||||||
		pgp_free(ctx);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (err)
 | 
						if (err)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		px_set_debug_handler(NULL);
 | 
							px_set_debug_handler(NULL);
 | 
				
			||||||
		if (dst)
 | 
							mbuf_free(dst);
 | 
				
			||||||
			mbuf_free(dst);
 | 
					 | 
				
			||||||
		ereport(ERROR,
 | 
							ereport(ERROR,
 | 
				
			||||||
				(errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
 | 
									(errcode(ERRCODE_EXTERNAL_ROUTINE_INVOCATION_EXCEPTION),
 | 
				
			||||||
				 errmsg("%s", px_strerror(err))));
 | 
									 errmsg("%s", px_strerror(err))));
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user