[NXDRVLINUX-150] - Fix "virteth" device allocation error, which led to an access violation at shutdown.

This commit is contained in:
Sebastian Doell 2024-03-21 14:05:25 +01:00
parent 578fc92ffd
commit 6018482357

View File

@ -264,19 +264,10 @@ void* cifxeth_create_device(NETX_ETH_DEV_CFG_T* config)
/* Device successfully created */ /* Device successfully created */
OS_EnterLock( g_eth_list_lock); OS_EnterLock( g_eth_list_lock);
if ((internal_dev = OS_Memalloc( sizeof(internal_dev))) != NULL)
{
TAILQ_INSERT_TAIL( &s_DeviceList, internal_dev, lentry); TAILQ_INSERT_TAIL( &s_DeviceList, internal_dev, lentry);
ret = internal_dev; ret = internal_dev;
}
OS_LeaveLock( g_eth_list_lock); OS_LeaveLock( g_eth_list_lock);
if(NULL == ret) return ret;
{
if(g_ulTraceLevel & TRACE_LEVEL_ERROR)
{
USER_Trace( internal_dev->devinst, TRACE_LEVEL_ERROR, "Ethernet-IF Error: Not enough memory to create cifx virtual ethernet interface!");
}
}
} }
} }
} }
@ -289,6 +280,12 @@ void* cifxeth_create_device(NETX_ETH_DEV_CFG_T* config)
{ {
cifxeth_delete_device( internal_dev); cifxeth_delete_device( internal_dev);
} }
} else
{
if(g_ulTraceLevel & TRACE_LEVEL_ERROR)
{
USER_Trace( internal_dev->devinst, TRACE_LEVEL_ERROR, "Ethernet-IF Error: Not enough memory to create cifx virtual ethernet interface!");
}
} }
channel_no++; channel_no++;
} }