ryantimwilson / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone
65878a
From 540aab87440dbde3bf6a1d057df9c7a79adf7031 Mon Sep 17 00:00:00 2001
65878a
From: David Herrmann <dh.herrmann@gmail.com>
65878a
Date: Thu, 10 Oct 2013 13:09:37 +0200
65878a
Subject: [PATCH] login: fix invalid free() in sd_session_get_vt()
65878a
65878a
We need to clear variables markes as _cleanup_free_. Otherwise, our
65878a
error-paths might corrupt random memory.
65878a
---
65878a
 src/login/sd-login.c | 2 +-
65878a
 1 file changed, 1 insertion(+), 1 deletion(-)
65878a
65878a
diff --git a/src/login/sd-login.c b/src/login/sd-login.c
65878a
index 71d8c29..6c27dfe 100644
65878a
--- a/src/login/sd-login.c
65878a
+++ b/src/login/sd-login.c
65878a
@@ -350,7 +350,7 @@ _public_ int sd_session_get_tty(const char *session, char **tty) {
65878a
 }
65878a
 
65878a
 _public_ int sd_session_get_vt(const char *session, unsigned *vtnr) {
65878a
-        _cleanup_free_ char *vtnr_string;
65878a
+        _cleanup_free_ char *vtnr_string = NULL;
65878a
         unsigned u;
65878a
         int r;
65878a