/*
- * Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2016-2022 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <openssl/bio.h>
#include <openssl/evp.h>
#include <openssl/ssl.h>
-#include <internal/nelem.h>
+#include "internal/nelem.h"
#include "fuzzer.h"
static ASN1_ITEM_EXP *item_type[] = {
int len2; \
BIO *bio = BIO_new(BIO_s_null()); \
\
- PRINT(bio, type); \
- BIO_free(bio); \
+ if (bio != NULL) { \
+ PRINT(bio, type); \
+ BIO_free(bio); \
+ } \
len2 = I2D(type, &der); \
if (len2 != 0) {} \
OPENSSL_free(der); \
if (type != NULL) { \
BIO *bio = BIO_new(BIO_s_null()); \
\
- PRINT(bio, type, 0); \
- BIO_free(bio); \
+ if (bio != NULL) { \
+ PRINT(bio, type, 0); \
+ BIO_free(bio); \
+ } \
I2D(type, &der); \
OPENSSL_free(der); \
TYPE ## _free(type); \
if (type != NULL) { \
BIO *bio = BIO_new(BIO_s_null()); \
\
- PRINT(bio, type, 0, pctx); \
- BIO_free(bio); \
+ if (bio != NULL) { \
+ PRINT(bio, type, 0, pctx); \
+ BIO_free(bio); \
+ } \
I2D(type, &der); \
OPENSSL_free(der); \
TYPE ## _free(type); \
if (o != NULL) {
BIO *bio = BIO_new(BIO_s_null());
-
- ASN1_item_print(bio, o, 4, i, pctx);
- BIO_free(bio);
- ASN1_item_i2d(o, &der, i);
- OPENSSL_free(der);
+ if (bio != NULL) {
+ ASN1_item_print(bio, o, 4, i, pctx);
+ BIO_free(bio);
+ }
+ if (ASN1_item_i2d(o, &der, i) > 0) {
+ OPENSSL_free(der);
+ }
ASN1_item_free(o, i);
}
}