1
0
mirror of https://github.com/coturn/coturn.git synced 2025-10-24 20:41:03 +02:00

Fix memory leak in netengine.c (#1411)

This is in response to issue #1366
The clang static analyzer basically claims that there is a memory leak
happening in `set_ssl_ctx` for the variable `args`. The leak is
triggered when the base event `base` is NULL and the condition within
`set_ssl_ctx` is not triggered. Therefore as a patch I am adding an else
condition to free it. (It cannot be freed after the event is created by
`event_new` because `args` can be invoked as argument for callback
function later on)

Please let me know if this patch is helpful :)

---------

Co-authored-by: Pavel Punsky <eakraly@users.noreply.github.com>
This commit is contained in:
ashamedbit 2024-03-02 17:15:58 -05:00 committed by GitHub
parent 68b9f19f7f
commit 456e2e81b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -349,6 +349,10 @@ void set_ssl_ctx(ioa_engine_handle e, turn_params_t *params) {
args->next = params->tls_ctx_update_ev;
params->tls_ctx_update_ev = ev;
TURN_MUTEX_UNLOCK(&turn_params.tls_mutex);
} else {
if (args) {
free(args);
}
}
}