summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/comp
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/comp')
-rw-r--r--src/lib/libcrypto/comp/c_zlib.c18
-rw-r--r--src/lib/libcrypto/comp/comp_err.c2
2 files changed, 9 insertions, 11 deletions
diff --git a/src/lib/libcrypto/comp/c_zlib.c b/src/lib/libcrypto/comp/c_zlib.c
index eccfd09137..8adf35f3fc 100644
--- a/src/lib/libcrypto/comp/c_zlib.c
+++ b/src/lib/libcrypto/comp/c_zlib.c
@@ -136,15 +136,6 @@ struct zlib_state
136 136
137static int zlib_stateful_ex_idx = -1; 137static int zlib_stateful_ex_idx = -1;
138 138
139static void zlib_stateful_free_ex_data(void *obj, void *item,
140 CRYPTO_EX_DATA *ad, int ind,long argl, void *argp)
141 {
142 struct zlib_state *state = (struct zlib_state *)item;
143 inflateEnd(&state->istream);
144 deflateEnd(&state->ostream);
145 OPENSSL_free(state);
146 }
147
148static int zlib_stateful_init(COMP_CTX *ctx) 139static int zlib_stateful_init(COMP_CTX *ctx)
149 { 140 {
150 int err; 141 int err;
@@ -188,6 +179,12 @@ static int zlib_stateful_init(COMP_CTX *ctx)
188 179
189static void zlib_stateful_finish(COMP_CTX *ctx) 180static void zlib_stateful_finish(COMP_CTX *ctx)
190 { 181 {
182 struct zlib_state *state =
183 (struct zlib_state *)CRYPTO_get_ex_data(&ctx->ex_data,
184 zlib_stateful_ex_idx);
185 inflateEnd(&state->istream);
186 deflateEnd(&state->ostream);
187 OPENSSL_free(state);
191 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_COMP,ctx,&ctx->ex_data); 188 CRYPTO_free_ex_data(CRYPTO_EX_INDEX_COMP,ctx,&ctx->ex_data);
192 } 189 }
193 190
@@ -402,7 +399,7 @@ COMP_METHOD *COMP_zlib(void)
402 if (zlib_stateful_ex_idx == -1) 399 if (zlib_stateful_ex_idx == -1)
403 zlib_stateful_ex_idx = 400 zlib_stateful_ex_idx =
404 CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_COMP, 401 CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_COMP,
405 0,NULL,NULL,NULL,zlib_stateful_free_ex_data); 402 0,NULL,NULL,NULL,NULL);
406 CRYPTO_w_unlock(CRYPTO_LOCK_COMP); 403 CRYPTO_w_unlock(CRYPTO_LOCK_COMP);
407 if (zlib_stateful_ex_idx == -1) 404 if (zlib_stateful_ex_idx == -1)
408 goto err; 405 goto err;
@@ -784,6 +781,7 @@ static long bio_zlib_ctrl(BIO *b, int cmd, long num, void *ptr)
784 default: 781 default:
785 ret = BIO_ctrl(b->next_bio, cmd, num, ptr); 782 ret = BIO_ctrl(b->next_bio, cmd, num, ptr);
786 break; 783 break;
784
787 } 785 }
788 786
789 return ret; 787 return ret;
diff --git a/src/lib/libcrypto/comp/comp_err.c b/src/lib/libcrypto/comp/comp_err.c
index 187d68b725..661c94c3a4 100644
--- a/src/lib/libcrypto/comp/comp_err.c
+++ b/src/lib/libcrypto/comp/comp_err.c
@@ -1,6 +1,6 @@
1/* crypto/comp/comp_err.c */ 1/* crypto/comp/comp_err.c */
2/* ==================================================================== 2/* ====================================================================
3 * Copyright (c) 1999-2008 The OpenSSL Project. All rights reserved. 3 * Copyright (c) 1999-2007 The OpenSSL Project. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions