static int mempacket_test_new(BIO *bio)
{
    MEMPACKET_TEST_CTX *ctx;

    if (!TEST_ptr(ctx = OPENSSL_zalloc(sizeof(*ctx))))
        return 0;
    if (!TEST_ptr(ctx->pkts = sk_MEMPACKET_new_null())) {
        OPENSSL_free(ctx);
        return 0;
    }
    BIO_set_init(bio, 1);
    BIO_set_data(bio, ctx);
    return 1;
}
Exemple #2
0
static int mempacket_test_new(BIO *bio)
{
    MEMPACKET_TEST_CTX *ctx = calloc(1, sizeof(*ctx));
    if (ctx == NULL)
        return 0;

    ctx->pkts = sk_MEMPACKET_new_null();
    if (ctx->pkts == NULL) {
        free(ctx);
        return 0;
    }
    bio->init = 1;
    bio->ptr = ctx;
    return 1;
}