diff options
author | beck <> | 2014-04-17 13:37:50 +0000 |
---|---|---|
committer | beck <> | 2014-04-17 13:37:50 +0000 |
commit | bddb7c686e3d1aeb156722adc64b6c35ae720f87 (patch) | |
tree | 7595a93a27385c367802aa17ecf20f96551cf14d /src/lib/libcrypto/comp/c_zlib.c | |
parent | ecec66222d758996a4ff2671ca5026d9ede5ef76 (diff) | |
download | openbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.tar.gz openbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.tar.bz2 openbsd-bddb7c686e3d1aeb156722adc64b6c35ae720f87.zip |
Change library to use intrinsic memory allocation functions instead of
OPENSSL_foo wrappers. This changes:
OPENSSL_malloc->malloc
OPENSSL_free->free
OPENSSL_relloc->realloc
OPENSSL_freeFunc->free
Diffstat (limited to 'src/lib/libcrypto/comp/c_zlib.c')
-rw-r--r-- | src/lib/libcrypto/comp/c_zlib.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/libcrypto/comp/c_zlib.c b/src/lib/libcrypto/comp/c_zlib.c index 8adf35f3fc..2ced7c10cc 100644 --- a/src/lib/libcrypto/comp/c_zlib.c +++ b/src/lib/libcrypto/comp/c_zlib.c | |||
@@ -37,7 +37,7 @@ static void* zlib_zalloc(void* opaque, unsigned int no, unsigned int size) | |||
37 | { | 37 | { |
38 | void *p; | 38 | void *p; |
39 | 39 | ||
40 | p=OPENSSL_malloc(no*size); | 40 | p=malloc(no*size); |
41 | if (p) | 41 | if (p) |
42 | memset(p, 0, no*size); | 42 | memset(p, 0, no*size); |
43 | return p; | 43 | return p; |
@@ -46,7 +46,7 @@ static void* zlib_zalloc(void* opaque, unsigned int no, unsigned int size) | |||
46 | 46 | ||
47 | static void zlib_zfree(void* opaque, void* address) | 47 | static void zlib_zfree(void* opaque, void* address) |
48 | { | 48 | { |
49 | OPENSSL_free(address); | 49 | free(address); |
50 | } | 50 | } |
51 | 51 | ||
52 | #if 0 | 52 | #if 0 |
@@ -140,7 +140,7 @@ static int zlib_stateful_init(COMP_CTX *ctx) | |||
140 | { | 140 | { |
141 | int err; | 141 | int err; |
142 | struct zlib_state *state = | 142 | struct zlib_state *state = |
143 | (struct zlib_state *)OPENSSL_malloc(sizeof(struct zlib_state)); | 143 | (struct zlib_state *)malloc(sizeof(struct zlib_state)); |
144 | 144 | ||
145 | if (state == NULL) | 145 | if (state == NULL) |
146 | goto err; | 146 | goto err; |
@@ -173,7 +173,7 @@ static int zlib_stateful_init(COMP_CTX *ctx) | |||
173 | CRYPTO_set_ex_data(&ctx->ex_data,zlib_stateful_ex_idx,state); | 173 | CRYPTO_set_ex_data(&ctx->ex_data,zlib_stateful_ex_idx,state); |
174 | return 1; | 174 | return 1; |
175 | err: | 175 | err: |
176 | if (state) OPENSSL_free(state); | 176 | if (state) free(state); |
177 | return 0; | 177 | return 0; |
178 | } | 178 | } |
179 | 179 | ||
@@ -184,7 +184,7 @@ static void zlib_stateful_finish(COMP_CTX *ctx) | |||
184 | zlib_stateful_ex_idx); | 184 | zlib_stateful_ex_idx); |
185 | inflateEnd(&state->istream); | 185 | inflateEnd(&state->istream); |
186 | deflateEnd(&state->ostream); | 186 | deflateEnd(&state->ostream); |
187 | OPENSSL_free(state); | 187 | free(state); |
188 | 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); |
189 | } | 189 | } |
190 | 190 | ||
@@ -479,7 +479,7 @@ static int bio_zlib_new(BIO *bi) | |||
479 | return 0; | 479 | return 0; |
480 | } | 480 | } |
481 | #endif | 481 | #endif |
482 | ctx = OPENSSL_malloc(sizeof(BIO_ZLIB_CTX)); | 482 | ctx = malloc(sizeof(BIO_ZLIB_CTX)); |
483 | if(!ctx) | 483 | if(!ctx) |
484 | { | 484 | { |
485 | COMPerr(COMP_F_BIO_ZLIB_NEW, ERR_R_MALLOC_FAILURE); | 485 | COMPerr(COMP_F_BIO_ZLIB_NEW, ERR_R_MALLOC_FAILURE); |
@@ -518,15 +518,15 @@ static int bio_zlib_free(BIO *bi) | |||
518 | { | 518 | { |
519 | /* Destroy decompress context */ | 519 | /* Destroy decompress context */ |
520 | inflateEnd(&ctx->zin); | 520 | inflateEnd(&ctx->zin); |
521 | OPENSSL_free(ctx->ibuf); | 521 | free(ctx->ibuf); |
522 | } | 522 | } |
523 | if(ctx->obuf) | 523 | if(ctx->obuf) |
524 | { | 524 | { |
525 | /* Destroy compress context */ | 525 | /* Destroy compress context */ |
526 | deflateEnd(&ctx->zout); | 526 | deflateEnd(&ctx->zout); |
527 | OPENSSL_free(ctx->obuf); | 527 | free(ctx->obuf); |
528 | } | 528 | } |
529 | OPENSSL_free(ctx); | 529 | free(ctx); |
530 | bi->ptr = NULL; | 530 | bi->ptr = NULL; |
531 | bi->init = 0; | 531 | bi->init = 0; |
532 | bi->flags = 0; | 532 | bi->flags = 0; |
@@ -544,7 +544,7 @@ static int bio_zlib_read(BIO *b, char *out, int outl) | |||
544 | BIO_clear_retry_flags(b); | 544 | BIO_clear_retry_flags(b); |
545 | if(!ctx->ibuf) | 545 | if(!ctx->ibuf) |
546 | { | 546 | { |
547 | ctx->ibuf = OPENSSL_malloc(ctx->ibufsize); | 547 | ctx->ibuf = malloc(ctx->ibufsize); |
548 | if(!ctx->ibuf) | 548 | if(!ctx->ibuf) |
549 | { | 549 | { |
550 | COMPerr(COMP_F_BIO_ZLIB_READ, ERR_R_MALLOC_FAILURE); | 550 | COMPerr(COMP_F_BIO_ZLIB_READ, ERR_R_MALLOC_FAILURE); |
@@ -606,7 +606,7 @@ static int bio_zlib_write(BIO *b, const char *in, int inl) | |||
606 | BIO_clear_retry_flags(b); | 606 | BIO_clear_retry_flags(b); |
607 | if(!ctx->obuf) | 607 | if(!ctx->obuf) |
608 | { | 608 | { |
609 | ctx->obuf = OPENSSL_malloc(ctx->obufsize); | 609 | ctx->obuf = malloc(ctx->obufsize); |
610 | /* Need error here */ | 610 | /* Need error here */ |
611 | if(!ctx->obuf) | 611 | if(!ctx->obuf) |
612 | { | 612 | { |
@@ -754,7 +754,7 @@ static long bio_zlib_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
754 | { | 754 | { |
755 | if (ctx->ibuf) | 755 | if (ctx->ibuf) |
756 | { | 756 | { |
757 | OPENSSL_free(ctx->ibuf); | 757 | free(ctx->ibuf); |
758 | ctx->ibuf = NULL; | 758 | ctx->ibuf = NULL; |
759 | } | 759 | } |
760 | ctx->ibufsize = ibs; | 760 | ctx->ibufsize = ibs; |
@@ -764,7 +764,7 @@ static long bio_zlib_ctrl(BIO *b, int cmd, long num, void *ptr) | |||
764 | { | 764 | { |
765 | if (ctx->obuf) | 765 | if (ctx->obuf) |
766 | { | 766 | { |
767 | OPENSSL_free(ctx->obuf); | 767 | free(ctx->obuf); |
768 | ctx->obuf = NULL; | 768 | ctx->obuf = NULL; |
769 | } | 769 | } |
770 | ctx->obufsize = obs; | 770 | ctx->obufsize = obs; |