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.
This commit is contained in:
YaoBing Xiao 2025-06-05 13:46:06 +08:00 committed by Simon Ser
parent 7e7994dbb2
commit 9fb9e9f7d5
2 changed files with 2 additions and 1 deletions

View file

@ -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;

View file

@ -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) {