Skip to content

Commit

Permalink
fix: cacertifle leak in listener neg cases
Browse files Browse the repository at this point in the history
  • Loading branch information
qzhuyan committed Sep 26, 2023
1 parent ed2e4d4 commit 36da2ae
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions c_src/quicer_listener.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@ listen2(ErlNifEnv *env, __unused_parm__ int argc, const ERL_NIF_TERM argv[])
if (!parse_cacertfile_option(env, options, &cacertfile))
{
// TLS opt error not file content error
free(cacertfile);
return ERROR_TUPLE_2(ATOM_CACERTFILE);
}

Expand All @@ -284,6 +285,7 @@ listen2(ErlNifEnv *env, __unused_parm__ int argc, const ERL_NIF_TERM argv[])

if (!l_ctx)
{
free(cacertfile);
return ERROR_TUPLE_2(ATOM_ERROR_NOT_ENOUGH_MEMORY);
}

Expand Down Expand Up @@ -410,6 +412,7 @@ listen2(ErlNifEnv *env, __unused_parm__ int argc, const ERL_NIF_TERM argv[])
return OK_TUPLE_2(listenHandle);

exit: // errors..
free(cacertfile);
free_certificate(&CredConfig);
destroy_l_ctx(l_ctx);
return ret;
Expand Down

0 comments on commit 36da2ae

Please sign in to comment.