chiark / gitweb /
logind-session: Fix invalid free in the error case
authorJasper St. Pierre <jstpierre@mecheye.net>
Fri, 21 Feb 2014 16:22:42 +0000 (11:22 -0500)
committerKay Sievers <kay@vrfy.org>
Fri, 21 Feb 2014 18:50:38 +0000 (19:50 +0100)
utf8 needs to be initialized to NULL for the free for the early return,
otherwise we try to free invalid data.

src/login/logind-session.c

index 81d12cbcea89e06df8bb597576166fd375aaed26..548f049202e9c1baecb2b66ac1830f4e1c62a648 100644 (file)
@@ -1008,7 +1008,7 @@ error:
 }
 
 void session_restore_vt(Session *s) {
-        _cleanup_free_ char *utf8;
+        _cleanup_free_ char *utf8 = NULL;
         int vt, kb = K_XLATE;
         struct vt_mode mode = { 0 };