Le 11/03/2015 09:34, Didier Roche a écrit :
Le 11/03/2015 09:29, Martin Pitt a écrit :
Hello all,

Didier Roche [2015-03-10 17:56 +0100]:
--- a/src/fsckd/fsckd.c
+++ b/src/fsckd/fsckd.c
@@ -272,7 +272,7 @@ static int plymouth_send_message(int plymouth_fd, const char *message, bool upda
  }
static int manager_send_plymouth_message(Manager *m, const char *message) {
-        const char *plymouth_cancel_message = NULL;
+ _cleanup_free_ const char *plymouth_cancel_message = NULL, *l10n_cancel_message = NULL;
          int r;
As far as I can see, this would free(l10n_cancel_message) on exit, but
you must never free the result of gettext(). So split this into

   _cleanup_free_ const char *plymouth_cancel_message = NULL;
   const char *l10n_cancel_message;

Indeed (weird I didn't get a double free crash), but the man page says it's statically allocated. Will fix it and report while bringing up the other patch with the architecture modification.
Thanks!

Actually, none of then needed a cleanup_free as the second is a strjoina().

Here is the updated patch, thanks!
Didier
>From 0bca7777a5707de7e71abcf507454ec98ac4dec8 Mon Sep 17 00:00:00 2001
From: Didier Roche <didro...@ubuntu.com>
Date: Tue, 10 Mar 2015 08:58:23 +0100
Subject: [PATCH 1/3] fsckd: Don't use strjoina on gettext() call

---
 src/fsckd/fsckd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/fsckd/fsckd.c b/src/fsckd/fsckd.c
index 3c587a3..f24715c 100644
--- a/src/fsckd/fsckd.c
+++ b/src/fsckd/fsckd.c
@@ -272,7 +272,7 @@ static int plymouth_send_message(int plymouth_fd, const char *message, bool upda
 }
 
 static int manager_send_plymouth_message(Manager *m, const char *message) {
-        const char *plymouth_cancel_message = NULL;
+        const char *plymouth_cancel_message = NULL, *l10n_cancel_message = NULL;
         int r;
 
         r = manager_connect_plymouth(m);
@@ -288,7 +288,8 @@ static int manager_send_plymouth_message(Manager *m, const char *message) {
 
                 m->plymouth_cancel_sent = true;
 
-                plymouth_cancel_message = strjoina("fsckd-cancel-msg:", _("Press Ctrl+C to cancel all filesystem checks in progress"));
+                l10n_cancel_message = _("Press Ctrl+C to cancel all filesystem checks in progress");
+                plymouth_cancel_message = strjoina("fsckd-cancel-msg:", l10n_cancel_message);
 
                 r = plymouth_send_message(m->plymouth_fd, plymouth_cancel_message, false);
                 if (r < 0)
-- 
2.1.4

_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to