mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-10 09:40:53 +01: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>
|
||||
class MutableRef : public T {
|
||||
public:
|
||||
T* t;
|
||||
const T* t;
|
||||
const T& operator = (const T* other) {
|
||||
t = other;
|
||||
return *t;
|
||||
@ -133,7 +133,7 @@ extern "C" int main(int argc, const char * argv[])
|
||||
|
||||
Background = &test;
|
||||
test = 6;
|
||||
float test2 = Background.get();
|
||||
float test2 = Background.get(); (void)test2;
|
||||
|
||||
Test t;
|
||||
TestWithOverride t1;
|
||||
|
@ -438,8 +438,9 @@ void ConfigManager::DiscoverDevices()
|
||||
hda->controller_device_id = Pci.Hdr.DeviceId;
|
||||
|
||||
// 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])) {
|
||||
DBG(" - HDMI Audio: \n");
|
||||
|
@ -90,7 +90,7 @@ class DiscoveredHdaProperties
|
||||
public:
|
||||
UINT16 controller_vendor_id = 0;
|
||||
UINT16 controller_device_id = 0;
|
||||
CHAR16 *controller_name = 0;
|
||||
XStringW controller_name = XStringW();
|
||||
|
||||
DiscoveredHdaProperties() {}
|
||||
};
|
||||
|
@ -1696,7 +1696,7 @@ REFIT_ABSTRACT_MENU_ENTRY *SubMenuAudio()
|
||||
for (UINTN i = 0 ; i < gConf.HdaPropertiesArray.size() ; i++) {
|
||||
SubScreen->AddMenuInfoLine_f("%llu) %ls [%04hX][%04hX]",
|
||||
(i+1),
|
||||
gConf.HdaPropertiesArray[i].controller_name,
|
||||
gConf.HdaPropertiesArray[i].controller_name.wc_str(),
|
||||
gConf.HdaPropertiesArray[i].controller_vendor_id,
|
||||
gConf.HdaPropertiesArray[i].controller_device_id
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user