[Spice-devel] [PATCH linux/vd-agent 02/11] session: free active session

marcandre.lureau at redhat.com marcandre.lureau at redhat.com
Fri Mar 22 15:12:37 UTC 2019


From: Marc-André Lureau <marcandre.lureau at redhat.com>

According to sd_seat_get_active(2), you must free() the pointer.

Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
---
 src/vdagentd/systemd-login.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/vdagentd/systemd-login.c b/src/vdagentd/systemd-login.c
index a11b66d..0b2dd0a 100644
--- a/src/vdagentd/systemd-login.c
+++ b/src/vdagentd/systemd-login.c
@@ -266,6 +266,7 @@ const char *session_info_get_active_session(struct session_info *si)
     int r;
     char *old_session = si->session;
 
+    free(si->session);
     si->session = NULL;
     r = sd_seat_get_active("seat0", &si->session, NULL);
     /* ENOENT happens when a seat is switching from one session to another */
-- 
2.21.0.4.g36eb1cb9cf



More information about the Spice-devel mailing list