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.

(cherry picked from commit 9fb9e9f7d5)
This commit is contained in:
YaoBing Xiao 2025-06-05 13:46:06 +08:00 committed by Simon Ser
parent 8174ff2fe2
commit f4a33dcab5
2 changed files with 2 additions and 1 deletions

View file

@ -27,7 +27,7 @@ struct sway_session_lock {
struct sway_server { struct sway_server {
struct wl_display *wl_display; struct wl_display *wl_display;
struct wl_event_loop *wl_event_loop; struct wl_event_loop *wl_event_loop;
const char *socket; char *socket;
struct wlr_backend *backend; struct wlr_backend *backend;
struct wlr_session *session; struct wlr_session *session;

View file

@ -502,6 +502,7 @@ void server_fini(struct sway_server *server) {
wlr_backend_destroy(server->backend); wlr_backend_destroy(server->backend);
wl_display_destroy(server->wl_display); wl_display_destroy(server->wl_display);
list_free(server->dirty_nodes); list_free(server->dirty_nodes);
free(server->socket);
} }
bool server_start(struct sway_server *server) { bool server_start(struct sway_server *server) {