Skip to content

Commit

Permalink
Reset pointers after destroying global tables in the core
Browse files Browse the repository at this point in the history
  • Loading branch information
lminiero committed Feb 6, 2024
1 parent 360d9ce commit bcc5b32
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions src/janus.c
Expand Up @@ -5963,11 +5963,11 @@ gint main(int argc, char *argv[]) {
JANUS_LOG(LOG_INFO, "Closing transport plugins:\n");
if(transports != NULL && g_hash_table_size(transports) > 0) {
g_hash_table_foreach(transports, janus_transport_close, NULL);
g_hash_table_destroy(transports);
g_clear_pointer(&transports, g_hash_table_destroy);
}
if(transports_so != NULL && g_hash_table_size(transports_so) > 0) {
g_hash_table_foreach(transports_so, janus_transportso_close, NULL);
g_hash_table_destroy(transports_so);
g_clear_pointer(&transports_so, g_hash_table_destroy);
}
/* Get rid of requests tasks and thread too */
g_thread_pool_free(tasks, FALSE, FALSE);
Expand All @@ -5994,22 +5994,22 @@ gint main(int argc, char *argv[]) {
JANUS_LOG(LOG_INFO, "Closing plugins:\n");
if(plugins != NULL && g_hash_table_size(plugins) > 0) {
g_hash_table_foreach(plugins, janus_plugin_close, NULL);
g_hash_table_destroy(plugins);
g_clear_pointer(&plugins, g_hash_table_destroy);
}
if(plugins_so != NULL && g_hash_table_size(plugins_so) > 0) {
g_hash_table_foreach(plugins_so, janus_pluginso_close, NULL);
g_hash_table_destroy(plugins_so);
g_clear_pointer(&plugins_so, g_hash_table_destroy);
}

JANUS_LOG(LOG_INFO, "Closing event handlers:\n");
janus_events_deinit();
if(eventhandlers != NULL && g_hash_table_size(eventhandlers) > 0) {
g_hash_table_foreach(eventhandlers, janus_eventhandler_close, NULL);
g_hash_table_destroy(eventhandlers);
g_clear_pointer(&eventhandlers, g_hash_table_destroy);
}
if(eventhandlers_so != NULL && g_hash_table_size(eventhandlers_so) > 0) {
g_hash_table_foreach(eventhandlers_so, janus_eventhandlerso_close, NULL);
g_hash_table_destroy(eventhandlers_so);
g_clear_pointer(&eventhandlers_so, g_hash_table_destroy);
}

janus_recorder_deinit();
Expand All @@ -6018,7 +6018,7 @@ gint main(int argc, char *argv[]) {
g_list_free(public_ips);
}
if (public_ips_table) {
g_hash_table_destroy(public_ips_table);
g_clear_pointer(&public_ips_table, g_hash_table_destroy);
}

if(janus_ice_get_static_event_loops() > 0)
Expand Down
2 changes: 1 addition & 1 deletion src/sctp.c
Expand Up @@ -152,7 +152,7 @@ void janus_sctp_deinit(void) {
usrsctp_finish();
sctp_running = FALSE;
janus_mutex_lock(&sctp_mutex);
g_hash_table_unref(sctp_ids);
g_clear_pointer(&sctp_ids, g_hash_table_destroy);
janus_mutex_unlock(&sctp_mutex);
}

Expand Down

0 comments on commit bcc5b32

Please sign in to comment.