On Sun, Jul 22, 2018 at 3:03 PM, <minf...@apache.org> wrote: > > --- apr/apr/trunk/test/testcrypto.c (original) > +++ apr/apr/trunk/test/testcrypto.c Sun Jul 22 13:03:42 2018 > @@ -1523,7 +1524,7 @@ static const unsigned char test_PRNG_kat > static void test_crypto_prng(abts_case *tc, void *data) > { > unsigned char randbytes[128], seed[APR_CRYPTO_PRNG_SEED_SIZE]; > - apr_crypto_prng_t *cprng; > + apr_crypto_prng_t *cprng = NULL; > apr_pool_t *pool = NULL; > apr_status_t rv; > int i; > @@ -1552,8 +1553,10 @@ static void test_crypto_prng(abts_case * > rv == APR_SUCCESS); > } > > - rv = apr_crypto_prng_bytes(cprng, randbytes, 128 - 32); > - ABTS_ASSERT(tc, "apr_crypto_prng_bytes failed", rv == APR_SUCCESS); > + if (cprng) { > + rv = apr_crypto_prng_bytes(cprng, randbytes, 128 - 32); > + ABTS_ASSERT(tc, "apr_crypto_prng_bytes failed", rv == > APR_SUCCESS); > + }
I don't understand, how can "cprng" be NULL here (and below), did above apr_crypto_prng_create() failed? > > /* Should match the first time only */ > if (i != 0) { > @@ -1567,8 +1570,10 @@ static void test_crypto_prng(abts_case * > memcmp(randbytes, test_PRNG_kat0 + 32, 128 - 32) == > 0); > } > > - rv = apr_crypto_prng_destroy(cprng); > - ABTS_ASSERT(tc, "apr_crypto_prng_destroy failed", rv == APR_SUCCESS); > + if (cprng) { > + rv = apr_crypto_prng_destroy(cprng); > + ABTS_ASSERT(tc, "apr_crypto_prng_destroy failed", rv == > APR_SUCCESS); > + } > } Regards, Yann.