Fix a memory leak in compression
authorMatt Caswell <matt@openssl.org>
Thu, 21 May 2015 13:06:52 +0000 (14:06 +0100)
committerMatt Caswell <matt@openssl.org>
Fri, 22 May 2015 07:08:45 +0000 (08:08 +0100)
commit6b41b3f5eacc6b1bb851c9dce22d6e893f32ea7d
tree6ff560441aeed681a5e56e30b3974fa90d6d9271
parent3a752c85ee38a92d7777b8fe1cce2e54bf619529
Fix a memory leak in compression

The function RECORD_LAYER_clear() is supposed to clear the contents of the
RECORD_LAYER structure, but retain certain data such as buffers that are
allocated. Unfortunately one buffer (for compression) got missed and was
inadvertently being wiped, thus causing a memory leak.

In part this is due to the fact that RECORD_LAYER_clear() was reaching
inside SSL3_BUFFERs and SSL3_RECORDs, which it really shouldn't. So, I've
rewritten it to only clear the data it knows about, and to defer clearing
of SSL3_RECORD and SSL3_BUFFER structures to SSL_RECORD_clear() and the
new function SSL3_BUFFER_clear().

Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
ssl/record/rec_layer_s3.c
ssl/record/record_locl.h
ssl/record/ssl3_buffer.c
ssl/record/ssl3_record.c