From 15baf349fa6985262da39b70f2d496af104c478d Mon Sep 17 00:00:00 2001 From: Federico Angelilli Date: Sat, 16 Mar 2024 02:11:10 +0100 Subject: Fix some memory leaks and add valgrind support --- src/connect.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/connect.c') diff --git a/src/connect.c b/src/connect.c index ed5a23b..054153d 100644 --- a/src/connect.c +++ b/src/connect.c @@ -310,12 +310,13 @@ Connection *connect_create() g_assert_null(error); log_debug("RandR loaded [version=%d.%d]", randr_version->major_version, randr_version->minor_version); g_assert_cmpint(randr_version->major_version, >=, 1); + g_free(randr_version); xcb_randr_get_screen_info_cookie_t cookie = xcb_randr_get_screen_info(con->connection, con->screen->root); - xcb_randr_get_screen_info_reply_t *info_reply = xcb_randr_get_screen_info_reply(con->connection, cookie, &error); + con->info_reply = xcb_randr_get_screen_info_reply(con->connection, cookie, &error); g_assert_null(error); - con->screen_size = xcb_randr_get_screen_info_sizes(info_reply); + con->screen_size = xcb_randr_get_screen_info_sizes(con->info_reply); g_assert_nonnull(con->screen_size); log_debug("Screen size [width=%d, height=%d]", con->screen_size->width, con->screen_size->height); @@ -381,6 +382,8 @@ void connect_destroy(Connection *con) xcb_errors_context_free(con->errors); xcb_xrm_database_free(con->database); xcb_disconnect(con->connection); + + g_free(con->info_reply); g_free(con); } -- cgit v1.2.3