mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 16:34:18 +09:00
[channels] Check HashTable_SetHashFunction return
This commit is contained in:
@@ -319,7 +319,9 @@ static IWTSVirtualChannelManager* dvcman_new(drdynvcPlugin* plugin)
|
||||
if (!dvcman->channelsById)
|
||||
goto fail;
|
||||
|
||||
HashTable_SetHashFunction(dvcman->channelsById, channelIdHash);
|
||||
if (!HashTable_SetHashFunction(dvcman->channelsById, channelIdHash))
|
||||
goto fail;
|
||||
|
||||
obj = HashTable_KeyObject(dvcman->channelsById);
|
||||
WINPR_ASSERT(obj);
|
||||
obj->fnObjectEquals = channelIdMatch;
|
||||
@@ -335,7 +337,9 @@ static IWTSVirtualChannelManager* dvcman_new(drdynvcPlugin* plugin)
|
||||
dvcman->listeners = HashTable_New(TRUE);
|
||||
if (!dvcman->listeners)
|
||||
goto fail;
|
||||
HashTable_SetHashFunction(dvcman->listeners, HashTable_StringHash);
|
||||
|
||||
if (!HashTable_SetHashFunction(dvcman->listeners, HashTable_StringHash))
|
||||
goto fail;
|
||||
|
||||
obj = HashTable_KeyObject(dvcman->listeners);
|
||||
obj->fnObjectEquals = HashTable_StringCompare;
|
||||
|
||||
@@ -346,31 +346,43 @@ static const IWTSVirtualChannelCallback geometry_callbacks = { geometry_on_data_
|
||||
nullptr, /* Open */
|
||||
geometry_on_close, nullptr };
|
||||
|
||||
static void geometry_plugin_free(GeometryClientContext* context)
|
||||
{
|
||||
if (!context)
|
||||
return;
|
||||
HashTable_Free(context->geometries);
|
||||
free(context);
|
||||
}
|
||||
static void terminate_plugin_cb(GENERIC_DYNVC_PLUGIN* base)
|
||||
{
|
||||
GEOMETRY_PLUGIN* geometry = (GEOMETRY_PLUGIN*)base;
|
||||
|
||||
if (!geometry)
|
||||
return;
|
||||
|
||||
geometry_plugin_free(geometry->context);
|
||||
}
|
||||
|
||||
static UINT init_plugin_cb(GENERIC_DYNVC_PLUGIN* base, WINPR_ATTR_UNUSED rdpContext* rcontext,
|
||||
rdpSettings* settings)
|
||||
{
|
||||
GeometryClientContext* context = nullptr;
|
||||
GEOMETRY_PLUGIN* geometry = (GEOMETRY_PLUGIN*)base;
|
||||
|
||||
WINPR_ASSERT(base);
|
||||
WINPR_UNUSED(settings);
|
||||
|
||||
context = (GeometryClientContext*)calloc(1, sizeof(GeometryClientContext));
|
||||
GeometryClientContext* context =
|
||||
(GeometryClientContext*)calloc(1, sizeof(GeometryClientContext));
|
||||
if (!context)
|
||||
{
|
||||
WLog_Print(base->log, WLOG_ERROR, "calloc failed!");
|
||||
return CHANNEL_RC_NO_MEMORY;
|
||||
}
|
||||
goto fail;
|
||||
|
||||
context->geometries = HashTable_New(FALSE);
|
||||
if (!context->geometries)
|
||||
{
|
||||
WLog_Print(base->log, WLOG_ERROR, "unable to allocate geometries");
|
||||
free(context);
|
||||
return CHANNEL_RC_NO_MEMORY;
|
||||
}
|
||||
goto fail;
|
||||
|
||||
if (!HashTable_SetHashFunction(context->geometries, mappedGeometryHash))
|
||||
goto fail;
|
||||
|
||||
HashTable_SetHashFunction(context->geometries, mappedGeometryHash);
|
||||
{
|
||||
wObject* obj = HashTable_KeyObject(context->geometries);
|
||||
obj->fnObjectEquals = mappedGeometryKeyCompare;
|
||||
@@ -385,15 +397,10 @@ static UINT init_plugin_cb(GENERIC_DYNVC_PLUGIN* base, WINPR_ATTR_UNUSED rdpCont
|
||||
geometry->base.iface.pInterface = (void*)context;
|
||||
|
||||
return CHANNEL_RC_OK;
|
||||
}
|
||||
|
||||
static void terminate_plugin_cb(GENERIC_DYNVC_PLUGIN* base)
|
||||
{
|
||||
GEOMETRY_PLUGIN* geometry = (GEOMETRY_PLUGIN*)base;
|
||||
|
||||
if (geometry->context)
|
||||
HashTable_Free(geometry->context->geometries);
|
||||
free(geometry->context);
|
||||
fail:
|
||||
geometry_plugin_free(context);
|
||||
return CHANNEL_RC_NO_MEMORY;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3707,7 +3707,8 @@ static RdpdrServerPrivate* rdpdr_server_private_new(void)
|
||||
if (!priv->devicelist)
|
||||
goto fail;
|
||||
|
||||
HashTable_SetHashFunction(priv->devicelist, rdpdr_deviceid_hash);
|
||||
if (!HashTable_SetHashFunction(priv->devicelist, rdpdr_deviceid_hash))
|
||||
goto fail;
|
||||
|
||||
{
|
||||
wObject* obj = HashTable_ValueObject(priv->devicelist);
|
||||
|
||||
Reference in New Issue
Block a user