mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-09-21 02:51:04 +02:00
Change DiscoveredHdaProperties.controller_name to avoid a memory leak.
This commit is contained in:
parent
87d5576923
commit
22d277d1e4
@ -110,7 +110,7 @@ public:
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
class MutableRef : public T {
|
class MutableRef : public T {
|
||||||
public:
|
public:
|
||||||
T* t;
|
const T* t;
|
||||||
const T& operator = (const T* other) {
|
const T& operator = (const T* other) {
|
||||||
t = other;
|
t = other;
|
||||||
return *t;
|
return *t;
|
||||||
@ -133,7 +133,7 @@ extern "C" int main(int argc, const char * argv[])
|
|||||||
|
|
||||||
Background = &test;
|
Background = &test;
|
||||||
test = 6;
|
test = 6;
|
||||||
float test2 = Background.get();
|
float test2 = Background.get(); (void)test2;
|
||||||
|
|
||||||
Test t;
|
Test t;
|
||||||
TestWithOverride t1;
|
TestWithOverride t1;
|
||||||
|
@ -438,8 +438,9 @@ void ConfigManager::DiscoverDevices()
|
|||||||
hda->controller_device_id = Pci.Hdr.DeviceId;
|
hda->controller_device_id = Pci.Hdr.DeviceId;
|
||||||
|
|
||||||
// HDA Controller Info
|
// HDA Controller Info
|
||||||
HdaControllerGetName(((hda->controller_device_id << 16) | hda->controller_vendor_id), &hda->controller_name);
|
CHAR16* name;
|
||||||
|
HdaControllerGetName(((hda->controller_device_id << 16) | hda->controller_vendor_id), &name);
|
||||||
|
hda->controller_name.stealValueFrom(name, wcslen(name) + 1); // we "steal" the value of name, so we sace one memory allocation, and we don't have de free.
|
||||||
|
|
||||||
if (IsHDMIAudio(HandleArray[Index])) {
|
if (IsHDMIAudio(HandleArray[Index])) {
|
||||||
DBG(" - HDMI Audio: \n");
|
DBG(" - HDMI Audio: \n");
|
||||||
|
@ -90,7 +90,7 @@ class DiscoveredHdaProperties
|
|||||||
public:
|
public:
|
||||||
UINT16 controller_vendor_id = 0;
|
UINT16 controller_vendor_id = 0;
|
||||||
UINT16 controller_device_id = 0;
|
UINT16 controller_device_id = 0;
|
||||||
CHAR16 *controller_name = 0;
|
XStringW controller_name = XStringW();
|
||||||
|
|
||||||
DiscoveredHdaProperties() {}
|
DiscoveredHdaProperties() {}
|
||||||
};
|
};
|
||||||
|
@ -1696,7 +1696,7 @@ REFIT_ABSTRACT_MENU_ENTRY *SubMenuAudio()
|
|||||||
for (UINTN i = 0 ; i < gConf.HdaPropertiesArray.size() ; i++) {
|
for (UINTN i = 0 ; i < gConf.HdaPropertiesArray.size() ; i++) {
|
||||||
SubScreen->AddMenuInfoLine_f("%llu) %ls [%04hX][%04hX]",
|
SubScreen->AddMenuInfoLine_f("%llu) %ls [%04hX][%04hX]",
|
||||||
(i+1),
|
(i+1),
|
||||||
gConf.HdaPropertiesArray[i].controller_name,
|
gConf.HdaPropertiesArray[i].controller_name.wc_str(),
|
||||||
gConf.HdaPropertiesArray[i].controller_vendor_id,
|
gConf.HdaPropertiesArray[i].controller_vendor_id,
|
||||||
gConf.HdaPropertiesArray[i].controller_device_id
|
gConf.HdaPropertiesArray[i].controller_device_id
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user