Add missing free calls

Co-authored-by: Maschell <Maschell@gmx.de>
This commit is contained in:
Maniac- 2022-02-04 22:42:53 +02:00 committed by GitHub
parent c56897cc75
commit 60fa230e19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 5 deletions

View File

@ -93,6 +93,10 @@ bool getQuickBoot() {
auto fileStream = new nn::sl::FileStream;
auto *fsClient = (FSClient *) memalign(0x40, sizeof(FSClient));
if (!fsClient) {
DEBUG_FUNCTION_LINE("Couldn't alloc memory for fsClient.");
return false;
}
memset(fsClient, 0, sizeof(*fsClient));
FSAddClient(fsClient, FS_ERROR_FLAG_NONE);
@ -113,6 +117,7 @@ bool getQuickBoot() {
delete fileStream;
FSDelClient(fsClient, FS_ERROR_FLAG_NONE);
free(fsClient);
nn::sl::Finalize();

View File

@ -29,7 +29,7 @@ static int numberUSBStorageDevicesConnected() {
memset(handle, 0, sizeof(UhsHandle));
auto *config = (UhsConfig *) memalign(0x40, sizeof(UhsConfig));
if (!config) {
free(config);
free(handle);
return -2;
}
memset(config, 0, sizeof(UhsConfig));
@ -37,9 +37,10 @@ static int numberUSBStorageDevicesConnected() {
config->controller_num = 0;
uint32_t size = 5120;
void *buffer = memalign(0x40, size);
if (buffer == nullptr) {
if (!buffer) {
free(handle);
free(config);
return -3;
}
memset(buffer, 0, size);
@ -51,7 +52,7 @@ static int numberUSBStorageDevicesConnected() {
free(handle);
free(config);
free(buffer);
return -3;
return -4;
}
UhsInterfaceProfile profiles[10];
@ -65,7 +66,7 @@ static int numberUSBStorageDevicesConnected() {
free(handle);
free(config);
free(buffer);
return -4;
return -5;
}
auto found = 0;
@ -79,7 +80,7 @@ static int numberUSBStorageDevicesConnected() {
UhsClientClose(handle);
free(handle);
free(config);
free(config->buffer);
free(buffer);
return found;
}