[channels,drdynvc] reset channel_callback before close

The channel_callback usually frees up the memory of the callback. To
ensure that there is no access to any of the data structures in it
invalidate the pointer used to access it before a free.
This commit is contained in:
akallabeth
2026-01-26 10:06:29 +01:00
parent 3d8219aac2
commit e02e052f66

View File

@@ -510,6 +510,7 @@ static UINT dvcman_channel_close(DVCMAN_CHANNEL* channel, BOOL perRequest, BOOL
{
IWTSVirtualChannelCallback* cb = channel->channel_callback;
channel->channel_callback = NULL;
if (cb)
{
check_open_close_receive(channel);
@@ -517,8 +518,6 @@ static UINT dvcman_channel_close(DVCMAN_CHANNEL* channel, BOOL perRequest, BOOL
}
}
channel->channel_callback = NULL;
if (channel->dvcman && channel->dvcman->drdynvc)
{
if (context)
@@ -796,14 +795,13 @@ out:
*/
static UINT dvcman_open_channel(drdynvcPlugin* drdynvc, DVCMAN_CHANNEL* channel)
{
IWTSVirtualChannelCallback* pCallback = NULL;
UINT error = CHANNEL_RC_OK;
WINPR_ASSERT(drdynvc);
WINPR_ASSERT(channel);
if (channel->state == DVC_CHANNEL_RUNNING)
{
pCallback = channel->channel_callback;
IWTSVirtualChannelCallback* pCallback = channel->channel_callback;
if (pCallback->OnOpen)
{