diff --git a/channels/rdpsnd/client/rdpsnd_main.c b/channels/rdpsnd/client/rdpsnd_main.c index 431cb1b35..1005303f3 100644 --- a/channels/rdpsnd/client/rdpsnd_main.c +++ b/channels/rdpsnd/client/rdpsnd_main.c @@ -650,12 +650,15 @@ static void rdpsnd_process_terminate(rdpSvcPlugin* plugin) if (rdpsnd->device) IFCALL(rdpsnd->device->Free, rdpsnd->device); - while ((item = list_dequeue(rdpsnd->data_out_list)) != NULL) + if (rdpsnd->data_out_list) { - stream_free(item->data_out); - free(item); + while ((item = list_dequeue(rdpsnd->data_out_list)) != NULL) + { + stream_free(item->data_out); + free(item); + } + list_free(rdpsnd->data_out_list); } - list_free(rdpsnd->data_out_list); if (rdpsnd->subsystem) free(rdpsnd->subsystem); diff --git a/libfreerdp/utils/svc_plugin.c b/libfreerdp/utils/svc_plugin.c index cf6e1d5eb..bfe33bdb6 100644 --- a/libfreerdp/utils/svc_plugin.c +++ b/libfreerdp/utils/svc_plugin.c @@ -338,16 +338,22 @@ static void svc_plugin_process_terminated(rdpSvcPlugin* plugin) { svc_data_in_item* item; - freerdp_thread_stop(plugin->priv->thread); - freerdp_thread_free(plugin->priv->thread); + if (plugin->priv->thread) + { + freerdp_thread_stop(plugin->priv->thread); + freerdp_thread_free(plugin->priv->thread); + } plugin->channel_entry_points.pVirtualChannelClose(plugin->priv->open_handle); svc_plugin_remove(plugin); - while ((item = list_dequeue(plugin->priv->data_in_list)) != NULL) - svc_data_in_item_free(item); - list_free(plugin->priv->data_in_list); + if (plugin->priv->data_in_list) + { + while ((item = list_dequeue(plugin->priv->data_in_list)) != NULL) + svc_data_in_item_free(item); + list_free(plugin->priv->data_in_list); + } if (plugin->priv->data_in != NULL) {