From 9844d763194cd0c8806b84f7346e887f8b52114b Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 24 Sep 2022 19:25:08 +0100 Subject: [PATCH] Fix a small leak Signed-off-by: falkTX --- data/valgrind.sh | 3 +++ source/backend/utils/Windows.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/data/valgrind.sh b/data/valgrind.sh index 9f9d6a607..2198f41d1 100755 --- a/data/valgrind.sh +++ b/data/valgrind.sh @@ -29,3 +29,6 @@ while true; do done wait ${PID} + +# export PYTHONMALLOC=malloc +# valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --gen-suppressions=all --suppressions=./data/valgrind.supp python3 ./source/frontend/carla diff --git a/source/backend/utils/Windows.cpp b/source/backend/utils/Windows.cpp index 9e4e74ca8..61f1ec70e 100644 --- a/source/backend/utils/Windows.cpp +++ b/source/backend/utils/Windows.cpp @@ -48,6 +48,7 @@ double carla_get_desktop_scale_factor() if (::Display* const display = XOpenDisplay(nullptr)) { XrmInitialize(); + if (char* const rms = XResourceManagerString(display)) { if (const XrmDatabase sdb = XrmGetStringDatabase(rms)) @@ -64,8 +65,11 @@ double carla_get_desktop_scale_factor() if (carla_isNotZero(dpi)) return dpi / 96; } + + XrmDestroyDatabase(sdb); } } + XCloseDisplay(display); } #endif