mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-12-23 05:53:40 +00:00
[common] use correct argument order for calloc
The signature for calloc is void *calloc(size_t num, size_t size), where num is the number of elements to allocate, and size is the size. Therefore, to allocate a single struct, we should pass 1 for num and the size of the struct as size. In some places, we use the opposite order, and we should flip it.
This commit is contained in:
parent
b7d3bbbd82
commit
4d907cecab
@ -39,7 +39,7 @@ struct LGEvent
|
||||
|
||||
LGEvent * lgCreateEvent(bool autoReset, unsigned int msSpinTime)
|
||||
{
|
||||
LGEvent * handle = (LGEvent *)calloc(sizeof(*handle), 1);
|
||||
LGEvent * handle = (LGEvent *)calloc(1, sizeof(*handle));
|
||||
if (!handle)
|
||||
{
|
||||
DEBUG_ERROR("Failed to allocate memory");
|
||||
|
@ -160,7 +160,7 @@ bool ivshmemInit(struct IVSHMEM * dev)
|
||||
return false;
|
||||
}
|
||||
|
||||
infData = (PSP_DEVICE_INTERFACE_DETAIL_DATA)calloc(reqSize, 1);
|
||||
infData = (PSP_DEVICE_INTERFACE_DETAIL_DATA)calloc(1, reqSize);
|
||||
infData->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
|
||||
if (!SetupDiGetDeviceInterfaceDetail(devInfoSet, &devInterfaceData, infData, reqSize, NULL, NULL))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user