Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/DesktopMonitorBrightness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,12 @@ BOOL CALLBACK DesktopMonitorManager::MonitorEnum(HMONITOR hMon, HDC hdc, LPRECT
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< this is causing exceptions!!!
}
}

// Clean up allocated memory
if (pPhysicalMonitors != NULL) {
free(pPhysicalMonitors); // Deallocate the memory
pPhysicalMonitors = NULL; // Set the pointer to NULL to avoid using it again.
}

// we always return true to signal that we want to keep looking
return true;
Expand Down Expand Up @@ -476,4 +482,4 @@ BOOL CALLBACK DesktopMonitorManager::MonitorEnum(HMONITOR hMon, HDC hdc, LPRECT

error = buff.str();
return return_value;
}
}