mirror of
https://github.com/hyprwm/hyprlock.git
synced 2024-12-22 05:19:48 +01:00
core: fix a few reported leaks by asan (#349)
* widgets: add missing virtual destructor destructor is missing and as a consequence all sub classes gets wrongly destructed reported as "new-delete-type-mismatch" by asan. * gatherer: free memory allocated by pango with pango_parse_markup its up to the caller of the function to free the pointer to the text returned stored in this buf. * core: add destructor and free devices add a destructor and free both drmDevice and gbmDevice, leaks reported by asan. * core: free xkb allocated state and keymap free xkb state and keymap on destruction to prevent leak on exit and less asan spam. * locksurface: destroy the surface frame on done the callback was never being destroyed and is leaking on each frameCallback creation, call wl_callback_destroy in onCallback() and free the memory. reported with asan.
This commit is contained in:
parent
972c1c27e6
commit
58c93d8de8
5 changed files with 18 additions and 0 deletions
|
@ -142,6 +142,7 @@ void CSessionLockSurface::render() {
|
|||
}
|
||||
|
||||
void CSessionLockSurface::onCallback() {
|
||||
wl_callback_destroy(frameCallback);
|
||||
frameCallback = nullptr;
|
||||
|
||||
if (needsFrame && !g_pHyprlock->m_bTerminate && g_pEGL)
|
||||
|
|
|
@ -39,6 +39,17 @@ CHyprlock::CHyprlock(const std::string& wlDisplay, const bool immediate) {
|
|||
}
|
||||
}
|
||||
|
||||
CHyprlock::~CHyprlock() {
|
||||
if (g_pHyprlock->dma.gbmDevice)
|
||||
gbm_device_destroy(g_pHyprlock->dma.gbmDevice);
|
||||
|
||||
if (g_pHyprlock->m_pXKBState)
|
||||
xkb_state_unref(g_pHyprlock->m_pXKBState);
|
||||
|
||||
if (g_pHyprlock->m_pXKBKeymap)
|
||||
xkb_keymap_unref(g_pHyprlock->m_pXKBKeymap);
|
||||
}
|
||||
|
||||
// wl_seat
|
||||
|
||||
static void handleCapabilities(void* data, wl_seat* wl_seat, uint32_t capabilities);
|
||||
|
@ -82,6 +93,7 @@ static void dmabufFeedbackMainDevice(void* data, zwp_linux_dmabuf_feedback_v1* f
|
|||
}
|
||||
|
||||
g_pHyprlock->dma.gbmDevice = g_pHyprlock->createGBMDevice(drmDev);
|
||||
drmFreeDevice(&drmDev);
|
||||
}
|
||||
|
||||
static void dmabufFeedbackFormatTable(void* data, zwp_linux_dmabuf_feedback_v1* feedback, int fd, uint32_t size) {
|
||||
|
|
|
@ -29,6 +29,7 @@ struct SDMABUFModifier {
|
|||
class CHyprlock {
|
||||
public:
|
||||
CHyprlock(const std::string& wlDisplay, const bool immediate);
|
||||
~CHyprlock();
|
||||
|
||||
void run();
|
||||
|
||||
|
|
|
@ -326,6 +326,9 @@ void CAsyncResourceGatherer::renderText(const SPreloadRequest& rq) {
|
|||
if (!attrList)
|
||||
attrList = pango_attr_list_new();
|
||||
|
||||
if (buf)
|
||||
free(buf);
|
||||
|
||||
pango_attr_list_insert(attrList, pango_attr_scale_new(1));
|
||||
pango_layout_set_attributes(layout, attrList);
|
||||
pango_attr_list_unref(attrList);
|
||||
|
|
|
@ -8,6 +8,7 @@ class IWidget {
|
|||
struct SRenderData {
|
||||
float opacity = 1;
|
||||
};
|
||||
virtual ~IWidget() = default;
|
||||
|
||||
virtual bool draw(const SRenderData& data) = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue