From: Karel Zak Date: Fri, 26 Sep 2014 09:23:32 +0000 (+0200) Subject: lslogins: cleanup after error [coverity scan] X-Git-Tag: v2.26-rc1~445 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=30ea015b87f79eb83e75c27dfcda890e3b8e7e83;p=thirdparty%2Futil-linux.git lslogins: cleanup after error [coverity scan] Signed-off-by: Karel Zak --- diff --git a/login-utils/lslogins.c b/login-utils/lslogins.c index 91831831a8..4503fe5d46 100644 --- a/login-utils/lslogins.c +++ b/login-utils/lslogins.c @@ -1064,13 +1064,13 @@ static void print_journal_tail(const char *journal_path, uid_t uid, size_t len) do { if (0 > sd_journal_get_data(j, "SYSLOG_IDENTIFIER", (const void **) &identifier, &identifier_len)) - return; + goto done; if (0 > sd_journal_get_data(j, "_PID", (const void **) &pid, &pid_len)) - return; + goto done; if (0 > sd_journal_get_data(j, "MESSAGE", (const void **) &message, &message_len)) - return; + goto done; sd_journal_get_realtime_usec(j, &x); t = x / 1000000; @@ -1087,6 +1087,7 @@ static void print_journal_tail(const char *journal_path, uid_t uid, size_t len) fprintf(stdout, "%s\n", message); } while (sd_journal_next(j)); +done: free(buf); free(match); sd_journal_flush_matches(j);