diff options
author | Lennart Poettering <lennart@poettering.net> | 2016-04-20 15:22:46 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2016-04-22 16:06:20 +0200 |
commit | 2b45d88163b29f04bf784385f4a490b2cf206861 (patch) | |
tree | 4779fc71a1d06d38330cdcce451268f9feadfd9f | |
parent | a11fe93e04e775c3ce2ace92be761d5ff9fce2d9 (diff) |
shared: fix minor memory leak in log display code
-rw-r--r-- | src/shared/logs-show.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/shared/logs-show.c b/src/shared/logs-show.c index 38a55525c0..15c818ccf1 100644 --- a/src/shared/logs-show.c +++ b/src/shared/logs-show.c @@ -1040,8 +1040,8 @@ static int show_journal(FILE *f, } int add_matches_for_unit(sd_journal *j, const char *unit) { + const char *m1, *m2, *m3, *m4; int r; - char *m1, *m2, *m3, *m4; assert(j); assert(unit); @@ -1073,7 +1073,9 @@ int add_matches_for_unit(sd_journal *j, const char *unit) { ); if (r == 0 && endswith(unit, ".slice")) { - const char *m5 = strjoina("_SYSTEMD_SLICE=", unit); + const char *m5; + + m5 = strjoina("_SYSTEMD_SLICE=", unit); /* Show all messages belonging to a slice */ (void)( @@ -1123,7 +1125,9 @@ int add_matches_for_user_unit(sd_journal *j, const char *unit, uid_t uid) { ); if (r == 0 && endswith(unit, ".slice")) { - char *m5 = strappend("_SYSTEMD_SLICE=", unit); + const char *m5; + + m5 = strjoina("_SYSTEMD_SLICE=", unit); /* Show all messages belonging to a slice */ (void)( |