Skip to content

Commit ce6b8df

Browse files
author
ali
committed
Fixed double free when using free func pointer
1 parent f50f4d9 commit ce6b8df

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bcal-basic.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,11 @@ void bcal_cipher_free(bcgen_ctx_t* ctx){
5757
return;
5858
bc_free_fpt free_fpt;
5959
free_fpt = (bc_free_fpt)(pgm_read_word(&(ctx->desc_ptr->free)));
60-
if(free_fpt)
60+
if(free_fpt) {
6161
free_fpt((ctx->ctx));
62-
free(ctx->ctx);
62+
} else {
63+
free(ctx->ctx);
64+
}
6365
}
6466

6567
void bcal_cipher_enc(void* block, const bcgen_ctx_t* ctx){

0 commit comments

Comments
 (0)