diff options
Diffstat (limited to 'crypto/bio')
-rw-r--r-- | crypto/bio/bio_err.c | 3 | ||||
-rw-r--r-- | crypto/bio/bio_meth.c | 14 |
2 files changed, 12 insertions, 5 deletions
diff --git a/crypto/bio/bio_err.c b/crypto/bio/bio_err.c index 50fc74bd85..20f3aa14f8 100644 --- a/crypto/bio/bio_err.c +++ b/crypto/bio/bio_err.c @@ -1,6 +1,6 @@ /* * Generated by util/mkerr.pl DO NOT EDIT - * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved. + * Copyright 1995-2018 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy @@ -30,6 +30,7 @@ static const ERR_STRING_DATA BIO_str_functs[] = { {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_LOOKUP, 0), "BIO_lookup"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_LOOKUP_EX, 0), "BIO_lookup_ex"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_MAKE_PAIR, 0), "bio_make_pair"}, + {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_METH_NEW, 0), "BIO_meth_new"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_NEW, 0), "BIO_new"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_NEW_DGRAM_SCTP, 0), "BIO_new_dgram_sctp"}, {ERR_PACK(ERR_LIB_BIO, BIO_F_BIO_NEW_FILE, 0), "BIO_new_file"}, diff --git a/crypto/bio/bio_meth.c b/crypto/bio/bio_meth.c index 1c5d196239..a1fff14160 100644 --- a/crypto/bio/bio_meth.c +++ b/crypto/bio/bio_meth.c @@ -37,16 +37,22 @@ BIO_METHOD *BIO_meth_new(int type, const char *name) { BIO_METHOD *biom = OPENSSL_zalloc(sizeof(BIO_METHOD)); - if (biom != NULL) { - biom->type = type; - biom->name = name; + if (biom == NULL + || (biom->name = OPENSSL_strdup(name)) == NULL) { + OPENSSL_free(biom); + BIOerr(BIO_F_BIO_METH_NEW, ERR_R_MALLOC_FAILURE); + return NULL; } + biom->type = type; return biom; } void BIO_meth_free(BIO_METHOD *biom) { - OPENSSL_free(biom); + if (biom != NULL) { + OPENSSL_free(biom->name); + OPENSSL_free(biom); + } } int (*BIO_meth_get_write(BIO_METHOD *biom)) (BIO *, const char *, int) |