diff options
author | FdaSilvaYY <fdasilvayy@gmail.com> | 2017-12-08 10:49:41 -0500 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2017-12-08 10:49:41 -0500 |
commit | a0fda2cf2dac8bc0d309261b3aaf4027a188b08c (patch) | |
tree | cdb682c910f5ae4825b1e3686facb1073f35c56d /crypto/bio/bss_mem.c | |
parent | cef115ff0ca4255d3decc1dda87c5418a961fd2c (diff) |
Address some code-analysis issues.
Expression '...' is always true.
The 'b->init' variable is assigned values twice successively
Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/4753)
Diffstat (limited to 'crypto/bio/bss_mem.c')
-rw-r--r-- | crypto/bio/bss_mem.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/crypto/bio/bss_mem.c b/crypto/bio/bss_mem.c index 621472594a..a50d416f2d 100644 --- a/crypto/bio/bss_mem.c +++ b/crypto/bio/bss_mem.c @@ -147,23 +147,19 @@ static int mem_buf_free(BIO *a, int free_all) { if (a == NULL) return 0; - if (a->shutdown) { - if ((a->init) && (a->ptr != NULL)) { - BUF_MEM *b; - BIO_BUF_MEM *bb = (BIO_BUF_MEM *)a->ptr; - - if (bb != NULL) { - b = bb->buf; - if (a->flags & BIO_FLAGS_MEM_RDONLY) - b->data = NULL; - BUF_MEM_free(b); - if (free_all) { - OPENSSL_free(bb->readp); - OPENSSL_free(bb); - } - } - a->ptr = NULL; + + if (a->shutdown && a->init && a->ptr != NULL) { + BIO_BUF_MEM *bb = (BIO_BUF_MEM *)a->ptr; + BUF_MEM *b = bb->buf; + + if (a->flags & BIO_FLAGS_MEM_RDONLY) + b->data = NULL; + BUF_MEM_free(b); + if (free_all) { + OPENSSL_free(bb->readp); + OPENSSL_free(bb); } + a->ptr = NULL; } return 1; } |