Skip to content

Commit

Permalink
blank-screens: fix memory leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
XPhyro committed Jan 1, 2024
1 parent 0ef346c commit 285375d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/cpp/util/core/blank-screens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,13 @@ int main(int argc, char* argv[])
}

if (output_info->connection)
continue;
goto next;

XRRCrtcInfo* crtc_info = XRRGetCrtcInfo(display, screen_resources, output_info->crtc);
XRRCrtcInfo* crtc_info;
crtc_info = XRRGetCrtcInfo(display, screen_resources, output_info->crtc);
if (!crtc_info) {
std::cerr << xph::exec_name << ": unable to get information for monitor " << i << '\n';
continue;
goto next;
}

windows.push_back(XCreateSimpleWindow(display,
Expand All @@ -75,8 +76,9 @@ int main(int argc, char* argv[])
0,
0));

XRRFreeOutputInfo(output_info);
XRRFreeCrtcInfo(crtc_info);
next:
XRRFreeOutputInfo(output_info);
}
XRRFreeScreenResources(screen_resources);

Expand Down

0 comments on commit 285375d

Please sign in to comment.