commit 9fb9e9f7d555ae7504b8ae53250020797d70e887
parent 7e7994dbb2a2c04f55b3c74eb61577c51e9a43ae
Author: YaoBing Xiao <xiaoyaobing@uniontech.com>
Date: Thu, 5 Jun 2025 13:46:06 +0800
server: fix socket path memory leak
The socket path allocated with strdup() in server_init() was
not being freed in server_fini().
Remove const qualifier and add proper cleanup.
Diffstat:
2 files changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/sway/server.h b/include/sway/server.h
@@ -27,7 +27,7 @@ struct sway_session_lock {
struct sway_server {
struct wl_display *wl_display;
struct wl_event_loop *wl_event_loop;
- const char *socket;
+ char *socket;
struct wlr_backend *backend;
struct wlr_session *session;
diff --git a/sway/server.c b/sway/server.c
@@ -502,6 +502,7 @@ void server_fini(struct sway_server *server) {
wlr_backend_destroy(server->backend);
wl_display_destroy(server->wl_display);
list_free(server->dirty_nodes);
+ free(server->socket);
}
bool server_start(struct sway_server *server) {