diff options
author | Ralf S. Engelschall <rse@openssl.org> | 1998-12-21 11:00:56 +0000 |
---|---|---|
committer | Ralf S. Engelschall <rse@openssl.org> | 1998-12-21 11:00:56 +0000 |
commit | dfeab0689f69c0b4bd3480ffd37a9cacc2f17d9c (patch) | |
tree | 2f74e0cfd76a9e092548a9bf52e579aef984299b /crypto/bio/bio_lib.c | |
parent | 58964a492275ca9a59a0cd9c8155cb2491b4b909 (diff) | |
download | openssl-dfeab0689f69c0b4bd3480ffd37a9cacc2f17d9c.tar.gz |
Import of old SSLeay release: SSLeay 0.9.1b (unreleased)
Diffstat (limited to 'crypto/bio/bio_lib.c')
-rw-r--r-- | crypto/bio/bio_lib.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/crypto/bio/bio_lib.c b/crypto/bio/bio_lib.c index 7a66b0892e..bee1f5d2e0 100644 --- a/crypto/bio/bio_lib.c +++ b/crypto/bio/bio_lib.c @@ -167,6 +167,7 @@ int outl; } i=b->method->bread(b,out,outl); + if (i > 0) b->num_read+=(unsigned long)i; if (cb != NULL) @@ -204,9 +205,16 @@ int inl; } i=b->method->bwrite(b,in,inl); + if (i > 0) b->num_write+=(unsigned long)i; - if (cb != NULL) + /* This is evil and not thread safe. If the BIO has been freed, + * we must not call the callback. The only way to be able to + * determine this is the reference count which is now invalid since + * the memory has been free()ed. + */ + if (b->references <= 0) abort(); + if (cb != NULL) /* && (b->references >= 1)) */ i=(int)cb(b,BIO_CB_WRITE|BIO_CB_RETURN,in,inl, 0L,(long)i); return(i); |