Replaced memset in urbdrc
authorakallabeth <akallabeth@posteo.net>
Fri, 3 Jul 2020 13:47:53 +0000 (15:47 +0200)
committerakallabeth <akallabeth@posteo.net>
Tue, 7 Jul 2020 08:44:12 +0000 (10:44 +0200)
(cherry picked from commit e84c3829bf942b28cd6ef4d7cff4d5f8cca8a5f8)

channels/urbdrc/client/libusb/libusb_udevice.c
channels/urbdrc/client/urbdrc_main.c

index ffa9e7e..36e667d 100644 (file)
@@ -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);
index 6a6dd75..2ed6a6f 100644 (file)
@@ -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 */