Fixed memory leak.
This commit is contained in:
parent
5cad081cc8
commit
5e360ddcb1
@ -450,7 +450,7 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
|
|||||||
if ((error = rdpdr_send_device_list_remove_request(rdpdr, 1, ids)))
|
if ((error = rdpdr_send_device_list_remove_request(rdpdr, 1, ids)))
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "rdpdr_send_device_list_remove_request failed with error %lu!", error);
|
WLog_ERR(TAG, "rdpdr_send_device_list_remove_request failed with error %lu!", error);
|
||||||
return error;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -468,10 +468,8 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
|
|||||||
if (!drive)
|
if (!drive)
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "calloc failed!");
|
WLog_ERR(TAG, "calloc failed!");
|
||||||
free(dev_array[i].path);
|
error = CHANNEL_RC_NO_MEMORY;
|
||||||
dev_array[i].path = NULL;
|
goto cleanup;
|
||||||
|
|
||||||
return CHANNEL_RC_NO_MEMORY;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
drive->Type = RDPDR_DTYP_FILESYSTEM;
|
drive->Type = RDPDR_DTYP_FILESYSTEM;
|
||||||
@ -483,7 +481,8 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
|
|||||||
{
|
{
|
||||||
WLog_ERR(TAG, "_strdup failed!");
|
WLog_ERR(TAG, "_strdup failed!");
|
||||||
free(drive);
|
free(drive);
|
||||||
return CHANNEL_RC_NO_MEMORY;
|
error = CHANNEL_RC_NO_MEMORY;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
name = strrchr(drive->Path, '/') + 1;
|
name = strrchr(drive->Path, '/') + 1;
|
||||||
drive->Name = _strdup(name);
|
drive->Name = _strdup(name);
|
||||||
@ -492,7 +491,8 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
|
|||||||
WLog_ERR(TAG, "_strdup failed!");
|
WLog_ERR(TAG, "_strdup failed!");
|
||||||
free(drive->Path);
|
free(drive->Path);
|
||||||
free(drive);
|
free(drive);
|
||||||
return CHANNEL_RC_NO_MEMORY;
|
error = CHANNEL_RC_NO_MEMORY;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if ((error = devman_load_device_service(rdpdr->devman, (RDPDR_DEVICE *)drive, rdpdr->rdpcontext)))
|
if ((error = devman_load_device_service(rdpdr->devman, (RDPDR_DEVICE *)drive, rdpdr->rdpcontext)))
|
||||||
{
|
{
|
||||||
@ -500,11 +500,22 @@ static UINT handle_hotplug(rdpdrPlugin* rdpdr)
|
|||||||
free(drive->Path);
|
free(drive->Path);
|
||||||
free(drive->Name);
|
free(drive->Name);
|
||||||
free(drive);
|
free(drive);
|
||||||
return error;
|
error = CHANNEL_RC_NO_MEMORY;
|
||||||
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
free (dev_array[size].path);
|
||||||
|
|
||||||
return rdpdr_send_device_list_announce_request(rdpdr, TRUE);
|
return rdpdr_send_device_list_announce_request(rdpdr, TRUE);
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
for (i = 0; i < size; i++)
|
||||||
|
free (dev_array[size].path);
|
||||||
|
|
||||||
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void* drive_hotplug_thread_func(void* arg)
|
static void* drive_hotplug_thread_func(void* arg)
|
||||||
|
Loading…
Reference in New Issue
Block a user