Skip to content

Commit b2b748b

Browse files
committed
DisplayServer (Linux): fixes a memory leak
1 parent 77ce6b0 commit b2b748b

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/detection/displayserver/linux/wayland/kde-output.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,16 @@ const char* ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* re
205205
wldata->ffwl_proxy_destroy(output);
206206
return "Failed to roundtrip kde_output_device_v2";
207207
}
208+
// Destroy any mode proxies that were created during the listeners.
209+
// wl proxies created for modes are not automatically freed by destroying
210+
// the parent output proxy, so destroy them explicitly to avoid leaks.
211+
FF_LIST_FOR_EACH (WaylandKdeMode, m, modes) {
212+
if (m->pMode) {
213+
wldata->ffwl_proxy_destroy((struct wl_proxy*) m->pMode);
214+
m->pMode = NULL;
215+
}
216+
}
217+
208218
wldata->ffwl_proxy_destroy(output);
209219

210220
if (display.width <= 0 || display.height <= 0 || !display.internal) {

0 commit comments

Comments
 (0)