As the potential failure of the ASN1_item_i2d,
it should be better to check the return value.
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18647)
ASN1_item_print(bio, o, 4, i, pctx);
BIO_free(bio);
}
- ASN1_item_i2d(o, &der, i);
- OPENSSL_free(der);
+ if (ASN1_item_i2d(o, &der, i) > 0) {
+ OPENSSL_free(der);
+ }
ASN1_item_free(o, i);
}
}