mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-23 21:32:39 +02:00
usb_comms: Correct scenarios when freeing the endpoint out buffer
Previously g_usbComms_endpoint_out_buffer wouldnt be freed in usbCommsExit, as g_usbComms_endpoint_out would be set to NULL before the conditional check
This commit is contained in:
parent
b7ce030c5a
commit
4b9a460fb6
@ -44,17 +44,13 @@ Result usbCommsInitialize(void)
|
|||||||
if (R_FAILED(ret)) {
|
if (R_FAILED(ret)) {
|
||||||
usbDsExit();
|
usbDsExit();
|
||||||
|
|
||||||
if (g_usbComms_endpoint_in_buffer) {
|
|
||||||
free(g_usbComms_endpoint_in_buffer);
|
free(g_usbComms_endpoint_in_buffer);
|
||||||
g_usbComms_endpoint_in_buffer = NULL;
|
g_usbComms_endpoint_in_buffer = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
if (g_usbComms_endpoint_out) {
|
|
||||||
free(g_usbComms_endpoint_out_buffer);
|
free(g_usbComms_endpoint_out_buffer);
|
||||||
g_usbComms_endpoint_out_buffer = NULL;
|
g_usbComms_endpoint_out_buffer = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
ret += 1000<<9;
|
ret += 1000<<9;
|
||||||
}
|
}
|
||||||
@ -75,15 +71,11 @@ void usbCommsExit(void)
|
|||||||
g_usbComms_endpoint_in = NULL;
|
g_usbComms_endpoint_in = NULL;
|
||||||
g_usbComms_endpoint_out = NULL;
|
g_usbComms_endpoint_out = NULL;
|
||||||
|
|
||||||
if (g_usbComms_endpoint_in_buffer) {
|
|
||||||
free(g_usbComms_endpoint_in_buffer);
|
free(g_usbComms_endpoint_in_buffer);
|
||||||
g_usbComms_endpoint_in_buffer = NULL;
|
g_usbComms_endpoint_in_buffer = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
if (g_usbComms_endpoint_out) {
|
|
||||||
free(g_usbComms_endpoint_out_buffer);
|
free(g_usbComms_endpoint_out_buffer);
|
||||||
g_usbComms_endpoint_out_buffer = NULL;
|
g_usbComms_endpoint_out_buffer = NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static Result _usbCommsInit(void)
|
static Result _usbCommsInit(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user