diff --git a/contrib/pgcrypto/pgp-pubenc.c b/contrib/pgcrypto/pgp-pubenc.c
index 4439876664..e4ff832f90 100644
--- a/contrib/pgcrypto/pgp-pubenc.c
+++ b/contrib/pgcrypto/pgp-pubenc.c
@@ -66,7 +66,7 @@ pad_eme_pkcs1_v15(uint8 *data, int data_len, int res_len, uint8 **res_p)
 			{
 				px_memset(buf, 0, res_len);
 				px_free(buf);
-				break;
+				return PXE_NO_RANDOM;
 			}
 		}
 		if (*p != 0)