Browse Source

Platform: ensure GLX configs are freed even in case of an error.

I thought this would fix a leak reported by ASan when running on Mesa 25
llvmpipe, but it didn't. Given that no leak is reported when *not*
running on llvmpipe, I assume this is llvmpipe's fault.
pull/680/head
Vladimír Vondruš 10 months ago
parent
commit
cf1ebf2133
  1. 4
      src/Magnum/Platform/WindowlessGlxApplication.cpp

4
src/Magnum/Platform/WindowlessGlxApplication.cpp

@ -27,6 +27,7 @@
#include "WindowlessGlxApplication.h" #include "WindowlessGlxApplication.h"
#include <Corrade/Containers/ScopeGuard.h>
#include <Corrade/Containers/StringView.h> #include <Corrade/Containers/StringView.h>
#include <Corrade/Utility/Assert.h> #include <Corrade/Utility/Assert.h>
#include <Corrade/Utility/Debug.h> #include <Corrade/Utility/Debug.h>
@ -100,6 +101,7 @@ WindowlessGlxContext::WindowlessGlxContext(const WindowlessGlxContext::Configura
Error() << "Platform::WindowlessGlxContext: no supported framebuffer configuration found"; Error() << "Platform::WindowlessGlxContext: no supported framebuffer configuration found";
return; return;
} }
Containers::ScopeGuard freeConfigs{configs, XFree};
/* Create pbuffer */ /* Create pbuffer */
constexpr static const int pbufferAttributes[] = { constexpr static const int pbufferAttributes[] = {
@ -266,8 +268,6 @@ WindowlessGlxContext::WindowlessGlxContext(const WindowlessGlxContext::Configura
static_cast<void>(magnumContext); static_cast<void>(magnumContext);
#endif #endif
XFree(configs);
if(!_context) { if(!_context) {
Error e; Error e;
e << "Platform::WindowlessGlxContext: cannot create context"; e << "Platform::WindowlessGlxContext: cannot create context";

Loading…
Cancel
Save