summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/engine/eng_dyn.c
diff options
context:
space:
mode:
authorbeck <>2014-04-17 13:37:50 +0000
committerbeck <>2014-04-17 13:37:50 +0000
commitbddb7c686e3d1aeb156722adc64b6c35ae720f87 (patch)
tree7595a93a27385c367802aa17ecf20f96551cf14d /src/lib/libcrypto/engine/eng_dyn.c
parentecec66222d758996a4ff2671ca5026d9ede5ef76 (diff)
downloadopenbsd-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/engine/eng_dyn.c')
-rw-r--r--src/lib/libcrypto/engine/eng_dyn.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/lib/libcrypto/engine/eng_dyn.c b/src/lib/libcrypto/engine/eng_dyn.c
index 807da7a5eb..7878bd802e 100644
--- a/src/lib/libcrypto/engine/eng_dyn.c
+++ b/src/lib/libcrypto/engine/eng_dyn.c
@@ -153,7 +153,7 @@ struct st_dynamic_data_ctx
153 * structure. */ 153 * structure. */
154static int dynamic_ex_data_idx = -1; 154static int dynamic_ex_data_idx = -1;
155 155
156static void int_free_str(char *s) { OPENSSL_free(s); } 156static void int_free_str(char *s) { free(s); }
157/* Because our ex_data element may or may not get allocated depending on whether 157/* Because our ex_data element may or may not get allocated depending on whether
158 * a "first-use" occurs before the ENGINE is freed, we have a memory leak 158 * a "first-use" occurs before the ENGINE is freed, we have a memory leak
159 * problem to solve. We can't declare a "new" handler for the ex_data as we 159 * problem to solve. We can't declare a "new" handler for the ex_data as we
@@ -170,12 +170,12 @@ static void dynamic_data_ctx_free_func(void *parent, void *ptr,
170 if(ctx->dynamic_dso) 170 if(ctx->dynamic_dso)
171 DSO_free(ctx->dynamic_dso); 171 DSO_free(ctx->dynamic_dso);
172 if(ctx->DYNAMIC_LIBNAME) 172 if(ctx->DYNAMIC_LIBNAME)
173 OPENSSL_free((void*)ctx->DYNAMIC_LIBNAME); 173 free((void*)ctx->DYNAMIC_LIBNAME);
174 if(ctx->engine_id) 174 if(ctx->engine_id)
175 OPENSSL_free((void*)ctx->engine_id); 175 free((void*)ctx->engine_id);
176 if(ctx->dirs) 176 if(ctx->dirs)
177 sk_OPENSSL_STRING_pop_free(ctx->dirs, int_free_str); 177 sk_OPENSSL_STRING_pop_free(ctx->dirs, int_free_str);
178 OPENSSL_free(ctx); 178 free(ctx);
179 } 179 }
180 } 180 }
181 181
@@ -186,7 +186,7 @@ static void dynamic_data_ctx_free_func(void *parent, void *ptr,
186static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) 186static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx)
187 { 187 {
188 dynamic_data_ctx *c; 188 dynamic_data_ctx *c;
189 c = OPENSSL_malloc(sizeof(dynamic_data_ctx)); 189 c = malloc(sizeof(dynamic_data_ctx));
190 if(!c) 190 if(!c)
191 { 191 {
192 ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); 192 ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE);
@@ -207,7 +207,7 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx)
207 if(!c->dirs) 207 if(!c->dirs)
208 { 208 {
209 ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); 209 ENGINEerr(ENGINE_F_DYNAMIC_SET_DATA_CTX,ERR_R_MALLOC_FAILURE);
210 OPENSSL_free(c); 210 free(c);
211 return 0; 211 return 0;
212 } 212 }
213 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE); 213 CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
@@ -223,7 +223,7 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx)
223 /* If we lost the race to set the context, c is non-NULL and *ctx is the 223 /* If we lost the race to set the context, c is non-NULL and *ctx is the
224 * context of the thread that won. */ 224 * context of the thread that won. */
225 if(c) 225 if(c)
226 OPENSSL_free(c); 226 free(c);
227 return 1; 227 return 1;
228 } 228 }
229 229
@@ -337,7 +337,7 @@ static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void))
337 if(p && (strlen((const char *)p) < 1)) 337 if(p && (strlen((const char *)p) < 1))
338 p = NULL; 338 p = NULL;
339 if(ctx->DYNAMIC_LIBNAME) 339 if(ctx->DYNAMIC_LIBNAME)
340 OPENSSL_free((void*)ctx->DYNAMIC_LIBNAME); 340 free((void*)ctx->DYNAMIC_LIBNAME);
341 if(p) 341 if(p)
342 ctx->DYNAMIC_LIBNAME = BUF_strdup(p); 342 ctx->DYNAMIC_LIBNAME = BUF_strdup(p);
343 else 343 else
@@ -351,7 +351,7 @@ static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)(void))
351 if(p && (strlen((const char *)p) < 1)) 351 if(p && (strlen((const char *)p) < 1))
352 p = NULL; 352 p = NULL;
353 if(ctx->engine_id) 353 if(ctx->engine_id)
354 OPENSSL_free((void*)ctx->engine_id); 354 free((void*)ctx->engine_id);
355 if(p) 355 if(p)
356 ctx->engine_id = BUF_strdup(p); 356 ctx->engine_id = BUF_strdup(p);
357 else 357 else
@@ -422,10 +422,10 @@ static int int_load(dynamic_data_ctx *ctx)
422 if(DSO_load(ctx->dynamic_dso, merge, NULL, 0)) 422 if(DSO_load(ctx->dynamic_dso, merge, NULL, 0))
423 { 423 {
424 /* Found what we're looking for */ 424 /* Found what we're looking for */
425 OPENSSL_free(merge); 425 free(merge);
426 return 1; 426 return 1;
427 } 427 }
428 OPENSSL_free(merge); 428 free(merge);
429 } 429 }
430 return 0; 430 return 0;
431 } 431 }