diff options
Diffstat (limited to 'src/lib/libcrypto/engine/eng_dyn.c')
| -rw-r--r-- | src/lib/libcrypto/engine/eng_dyn.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/lib/libcrypto/engine/eng_dyn.c b/src/lib/libcrypto/engine/eng_dyn.c index 4fefcc0cae..4139a16e76 100644 --- a/src/lib/libcrypto/engine/eng_dyn.c +++ b/src/lib/libcrypto/engine/eng_dyn.c | |||
| @@ -157,6 +157,10 @@ static void dynamic_data_ctx_free_func(void *parent, void *ptr, | |||
| 157 | dynamic_data_ctx *ctx = (dynamic_data_ctx *)ptr; | 157 | dynamic_data_ctx *ctx = (dynamic_data_ctx *)ptr; |
| 158 | if(ctx->dynamic_dso) | 158 | if(ctx->dynamic_dso) |
| 159 | DSO_free(ctx->dynamic_dso); | 159 | DSO_free(ctx->dynamic_dso); |
| 160 | if(ctx->DYNAMIC_LIBNAME) | ||
| 161 | OPENSSL_free((void*)ctx->DYNAMIC_LIBNAME); | ||
| 162 | if(ctx->engine_id) | ||
| 163 | OPENSSL_free((void*)ctx->engine_id); | ||
| 160 | OPENSSL_free(ctx); | 164 | OPENSSL_free(ctx); |
| 161 | } | 165 | } |
| 162 | } | 166 | } |
| @@ -169,7 +173,7 @@ static int dynamic_set_data_ctx(ENGINE *e, dynamic_data_ctx **ctx) | |||
| 169 | { | 173 | { |
| 170 | dynamic_data_ctx *c; | 174 | dynamic_data_ctx *c; |
| 171 | c = OPENSSL_malloc(sizeof(dynamic_data_ctx)); | 175 | c = OPENSSL_malloc(sizeof(dynamic_data_ctx)); |
| 172 | if(!ctx) | 176 | if(!c) |
| 173 | { | 177 | { |
| 174 | ENGINEerr(ENGINE_F_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); | 178 | ENGINEerr(ENGINE_F_SET_DATA_CTX,ERR_R_MALLOC_FAILURE); |
| 175 | return 0; | 179 | return 0; |
| @@ -310,8 +314,13 @@ static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | |||
| 310 | /* a NULL 'p' or a string of zero-length is the same thing */ | 314 | /* a NULL 'p' or a string of zero-length is the same thing */ |
| 311 | if(p && (strlen((const char *)p) < 1)) | 315 | if(p && (strlen((const char *)p) < 1)) |
| 312 | p = NULL; | 316 | p = NULL; |
| 313 | ctx->DYNAMIC_LIBNAME = (const char *)p; | 317 | if(ctx->DYNAMIC_LIBNAME) |
| 314 | return 1; | 318 | OPENSSL_free((void*)ctx->DYNAMIC_LIBNAME); |
| 319 | if(p) | ||
| 320 | ctx->DYNAMIC_LIBNAME = BUF_strdup(p); | ||
| 321 | else | ||
| 322 | ctx->DYNAMIC_LIBNAME = NULL; | ||
| 323 | return (ctx->DYNAMIC_LIBNAME ? 1 : 0); | ||
| 315 | case DYNAMIC_CMD_NO_VCHECK: | 324 | case DYNAMIC_CMD_NO_VCHECK: |
| 316 | ctx->no_vcheck = ((i == 0) ? 0 : 1); | 325 | ctx->no_vcheck = ((i == 0) ? 0 : 1); |
| 317 | return 1; | 326 | return 1; |
| @@ -319,8 +328,13 @@ static int dynamic_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f)()) | |||
| 319 | /* a NULL 'p' or a string of zero-length is the same thing */ | 328 | /* a NULL 'p' or a string of zero-length is the same thing */ |
| 320 | if(p && (strlen((const char *)p) < 1)) | 329 | if(p && (strlen((const char *)p) < 1)) |
| 321 | p = NULL; | 330 | p = NULL; |
| 322 | ctx->engine_id = (const char *)p; | 331 | if(ctx->engine_id) |
| 323 | return 1; | 332 | OPENSSL_free((void*)ctx->engine_id); |
| 333 | if(p) | ||
| 334 | ctx->engine_id = BUF_strdup(p); | ||
| 335 | else | ||
| 336 | ctx->engine_id = NULL; | ||
| 337 | return (ctx->engine_id ? 1 : 0); | ||
| 324 | case DYNAMIC_CMD_LIST_ADD: | 338 | case DYNAMIC_CMD_LIST_ADD: |
| 325 | if((i < 0) || (i > 2)) | 339 | if((i < 0) || (i > 2)) |
| 326 | { | 340 | { |
