From effbc11867c2571405365d23e4ec1a213453eaaf Mon Sep 17 00:00:00 2001 From: akallabeth Date: Fri, 3 Jul 2020 15:47:53 +0200 Subject: [PATCH] Replaced memset in urbdrc (cherry picked from commit e84c3829bf942b28cd6ef4d7cff4d5f8cca8a5f8) --- channels/urbdrc/client/libusb/libusb_udevice.c | 6 ++---- channels/urbdrc/client/urbdrc_main.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/channels/urbdrc/client/libusb/libusb_udevice.c b/channels/urbdrc/client/libusb/libusb_udevice.c index ffa9e7e..36e667d 100644 --- a/channels/urbdrc/client/libusb/libusb_udevice.c +++ b/channels/urbdrc/client/libusb/libusb_udevice.c @@ -561,8 +561,7 @@ libusb_udev_complete_msconfig_setup(IUDEVICE* idev, MSUSB_CONFIG_DESCRIPTOR* MsC for (pnum = 0; pnum < LibusbNumEndpoint; pnum++) { - t_MsPipe = (MSUSB_PIPE_DESCRIPTOR*)malloc(sizeof(MSUSB_PIPE_DESCRIPTOR)); - memset(t_MsPipe, 0, sizeof(MSUSB_PIPE_DESCRIPTOR)); + t_MsPipe = (MSUSB_PIPE_DESCRIPTOR*)calloc(1, sizeof(MSUSB_PIPE_DESCRIPTOR)); if (pnum < MsInterface->NumberOfPipes && MsInterface->MsPipes) { @@ -863,12 +862,11 @@ static int libusb_udev_os_feature_descriptor_request(IUDEVICE* idev, UINT32 Requ BYTE* Buffer, int Timeout) { UDEVICE* pdev = (UDEVICE*)idev; - BYTE ms_string_desc[0x13]; + BYTE ms_string_desc[0x13] = { 0 }; int error = 0; /* pdev->request_queue->register_request(pdev->request_queue, RequestId, NULL, 0); */ - memset(ms_string_desc, 0, 0x13); error = libusb_control_transfer(pdev->libusb_handle, LIBUSB_ENDPOINT_IN | Recipient, LIBUSB_REQUEST_GET_DESCRIPTOR, 0x03ee, 0, ms_string_desc, 0x12, Timeout); diff --git a/channels/urbdrc/client/urbdrc_main.c b/channels/urbdrc/client/urbdrc_main.c index 6a6dd75..2ed6a6f 100644 --- a/channels/urbdrc/client/urbdrc_main.c +++ b/channels/urbdrc/client/urbdrc_main.c @@ -86,7 +86,7 @@ static IWTSVirtualChannel* get_channel(IUDEVMAN* idevman) static int func_container_id_generate(IUDEVICE* pdev, char* strContainerId) { char *p, *path; - UINT8 containerId[17]; + UINT8 containerId[17] = { 0 }; UINT16 idVendor, idProduct; idVendor = (UINT16)pdev->query_device_descriptor(pdev, ID_VENDOR); idProduct = (UINT16)pdev->query_device_descriptor(pdev, ID_PRODUCT); @@ -97,7 +97,6 @@ static int func_container_id_generate(IUDEVICE* pdev, char* strContainerId) else p = path; - ZeroMemory(containerId, sizeof(containerId)); sprintf_s((char*)containerId, sizeof(containerId), "%04" PRIX16 "%04" PRIX16 "%s", idVendor, idProduct, p); /* format */ -- 2.7.4