mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2025-01-07 18:48:04 +01:00
few more memory leaks
Signed-off-by: Slice <sergey.slice@gmail.com>
This commit is contained in:
parent
187400d0ae
commit
d0b6b9b3b9
@ -1 +1 @@
|
|||||||
Subproject commit 242b260f6c5cb1f84e397160d1b387f3bac47e03
|
Subproject commit 67560f9924f612afe0e13a96af8438bbe81df8bd
|
@ -90,6 +90,7 @@ UINT32 pci_config_read32(pci_dt_t *PciDt, UINT8 reg)
|
|||||||
PCI_TYPE00 Pci;
|
PCI_TYPE00 Pci;
|
||||||
UINT32 res;
|
UINT32 res;
|
||||||
|
|
||||||
|
//somehow definition for gBS->OpenProtocol() is different from other parts of the project
|
||||||
Status = gBS->OpenProtocol(PciDt->DeviceHandle, gEfiPciIoProtocolGuid, (void**)&PciIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
Status = gBS->OpenProtocol(PciDt->DeviceHandle, gEfiPciIoProtocolGuid, (void**)&PciIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||||
if (EFI_ERROR(Status)){
|
if (EFI_ERROR(Status)){
|
||||||
DBG("pci_config_read cant open protocol\n");
|
DBG("pci_config_read cant open protocol\n");
|
||||||
@ -285,8 +286,10 @@ XBool devprop_add_value(DevPropDevice *device, CONST CHAR8 *nm, const UINT8 *vl,
|
|||||||
offset = device->length - (24 + (6 * device->num_pci_devpaths));
|
offset = device->length - (24 + (6 * device->num_pci_devpaths));
|
||||||
|
|
||||||
newdata = (UINT8*)AllocateZeroPool((length + offset));
|
newdata = (UINT8*)AllocateZeroPool((length + offset));
|
||||||
if(!newdata)
|
if(!newdata) {
|
||||||
|
FreePool(data);
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
if((device->data) && (offset > 1)) {
|
if((device->data) && (offset > 1)) {
|
||||||
CopyMem((void*)newdata, (void*)device->data, offset);
|
CopyMem((void*)newdata, (void*)device->data, offset);
|
||||||
}
|
}
|
||||||
@ -351,22 +354,22 @@ XBuffer<char> devprop_generate_string(DevPropString *StringBuf)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void devprop_free_string(DevPropString *StringBuf)
|
void devprop_free_string()
|
||||||
{
|
{
|
||||||
INT32 i;
|
INT32 i;
|
||||||
if(!StringBuf)
|
if(!device_inject_string)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(i = 0; i < StringBuf->numentries; i++) {
|
for(i = 0; i < device_inject_string->numentries; i++) {
|
||||||
if(StringBuf->entries[i]) {
|
if(device_inject_string->entries[i]) {
|
||||||
if(StringBuf->entries[i]->data) {
|
if(device_inject_string->entries[i]->data) {
|
||||||
FreePool(StringBuf->entries[i]->data);
|
FreePool(device_inject_string->entries[i]->data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FreePool(StringBuf->entries);
|
FreePool(device_inject_string->entries);
|
||||||
FreePool(StringBuf);
|
FreePool(device_inject_string);
|
||||||
// StringBuf = NULL;
|
device_inject_string = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static UINT8 builtin = 0x0;
|
static UINT8 builtin = 0x0;
|
||||||
|
@ -123,7 +123,7 @@ DevPropDevice *devprop_add_device_pci(DevPropString *string, pci_dt_t *PciDt, EF
|
|||||||
XBool devprop_add_value(DevPropDevice *device, CONST CHAR8 *nm, const UINT8 *vl, UINTN len); // to be removed
|
XBool devprop_add_value(DevPropDevice *device, CONST CHAR8 *nm, const UINT8 *vl, UINTN len); // to be removed
|
||||||
XBool devprop_add_value(DevPropDevice *device, const XString8& nm, const XBuffer<uint8_t>& vl);
|
XBool devprop_add_value(DevPropDevice *device, const XString8& nm, const XBuffer<uint8_t>& vl);
|
||||||
XBuffer<char> devprop_generate_string(DevPropString *string);
|
XBuffer<char> devprop_generate_string(DevPropString *string);
|
||||||
void devprop_free_string(DevPropString *string);
|
void devprop_free_string();
|
||||||
|
|
||||||
XBool set_eth_props(pci_dt_t *eth_dev);
|
XBool set_eth_props(pci_dt_t *eth_dev);
|
||||||
XBool set_usb_props(pci_dt_t *usb_dev);
|
XBool set_usb_props(pci_dt_t *usb_dev);
|
||||||
|
@ -1675,6 +1675,7 @@ EFI_STATUS read_nVidia_PRAMIN(pci_dt_t *nvda_dev, void* rom, UINT16 arch)
|
|||||||
UINT32 old_bar0_pramin = 0;
|
UINT32 old_bar0_pramin = 0;
|
||||||
|
|
||||||
DBG("read_nVidia_ROM\n");
|
DBG("read_nVidia_ROM\n");
|
||||||
|
//somehow definition for gBS->OpenProtocol() is different from other parts of the project
|
||||||
Status = gBS->OpenProtocol(nvda_dev->DeviceHandle, gEfiPciIoProtocolGuid, (void**)&PciIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
Status = gBS->OpenProtocol(nvda_dev->DeviceHandle, gEfiPciIoProtocolGuid, (void**)&PciIo, gImageHandle, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||||
if (EFI_ERROR(Status)) {
|
if (EFI_ERROR(Status)) {
|
||||||
return EFI_NOT_FOUND;
|
return EFI_NOT_FOUND;
|
||||||
|
@ -938,7 +938,7 @@ void ScanSPD()
|
|||||||
if (!EFI_ERROR(Status)) {
|
if (!EFI_ERROR(Status)) {
|
||||||
for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
|
for (ProtocolIndex = 0; ProtocolIndex < ArrayCount; ProtocolIndex++) {
|
||||||
if (CompareGuid(&gEfiPciIoProtocolGuid, ProtocolGuidArray[ProtocolIndex])) {
|
if (CompareGuid(&gEfiPciIoProtocolGuid, ProtocolGuidArray[ProtocolIndex])) {
|
||||||
Status = gBS->OpenProtocol(HandleBuffer[HandleIndex],gEfiPciIoProtocolGuid,(void **)&PciIo,gImageHandle,NULL,EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
Status = gBS->OpenProtocol(HandleBuffer[HandleIndex],&gEfiPciIoProtocolGuid,(void **)&PciIo,gImageHandle,NULL,EFI_OPEN_PROTOCOL_GET_PROTOCOL);
|
||||||
|
|
||||||
if (!EFI_ERROR(Status)) {
|
if (!EFI_ERROR(Status)) {
|
||||||
// Read PCI BUS
|
// Read PCI BUS
|
||||||
|
@ -70,6 +70,7 @@
|
|||||||
#include "../Platform/BootOptions.h"
|
#include "../Platform/BootOptions.h"
|
||||||
#include "../Platform/boot.h"
|
#include "../Platform/boot.h"
|
||||||
#include "../Platform/kext_inject.h"
|
#include "../Platform/kext_inject.h"
|
||||||
|
#include "../Platform/device_inject.h"
|
||||||
#include "../Platform/KextList.h"
|
#include "../Platform/KextList.h"
|
||||||
#include "../gui/REFIT_MENU_SCREEN.h"
|
#include "../gui/REFIT_MENU_SCREEN.h"
|
||||||
#include "../gui/REFIT_MAINMENU_SCREEN.h"
|
#include "../gui/REFIT_MAINMENU_SCREEN.h"
|
||||||
@ -760,6 +761,8 @@ void LOADER_ENTRY::StartLoader()
|
|||||||
delete ThemeX;
|
delete ThemeX;
|
||||||
ThemeX = NULL;
|
ThemeX = NULL;
|
||||||
|
|
||||||
|
devprop_free_string();
|
||||||
|
|
||||||
|
|
||||||
#ifdef NANOSVG_MEMORY_ALLOCATION_TRACE
|
#ifdef NANOSVG_MEMORY_ALLOCATION_TRACE
|
||||||
if ( nsvg__nbDanglingPtr() > 0 ) {
|
if ( nsvg__nbDanglingPtr() > 0 ) {
|
||||||
@ -1668,7 +1671,7 @@ void LOADER_ENTRY::StartLoader()
|
|||||||
Status = SaveBooterLog(&self.getCloverDir(), PREBOOT_LOG);
|
Status = SaveBooterLog(&self.getCloverDir(), PREBOOT_LOG);
|
||||||
}
|
}
|
||||||
|
|
||||||
displayFreeMemory("Just before lauching image"_XS8);
|
displayFreeMemory("Just before launching image"_XS8);
|
||||||
|
|
||||||
Status = gBS->StartImage (ImageHandle, 0, NULL); // point to OcStartImage from OC
|
Status = gBS->StartImage (ImageHandle, 0, NULL); // point to OcStartImage from OC
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user