[systemd-devel] [PATCH] journalctl: Unify boot id lookup into common function get_boots

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Wed Oct 22 22:06:02 PDT 2014


On Fri, Oct 10, 2014 at 01:21:10PM +0200, Jan Janssen wrote:
> ---
>  src/journal/journalctl.c | 133 +++++++++++++++++++++--------------------------
>  1 file changed, 58 insertions(+), 75 deletions(-)
> 
> diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
> index 328e40b..550b610 100644
> --- a/src/journal/journalctl.c
> +++ b/src/journal/journalctl.c
> @@ -824,28 +824,31 @@ static int boot_id_cmp(const void *a, const void *b) {
>          return _a < _b ? -1 : (_a > _b ? 1 : 0);
>  }
Hi,

sorry for not responding earlier.

This patch makes valgrind very unhappy:

% valgrind build/journalctl --list-boots
==17017== Memcheck, a memory error detector
==17017== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==17017== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==17017== Command: build/journalctl --list-boots
==17017== 
==17017== Conditional jump or move depends on uninitialised value(s)
==17017==    at 0x16B66F: greedy_realloc (util.c:5988)
==17017==    by 0x11262B: get_boots (journalctl.c:868)
==17017==    by 0x1128ED: list_boots (journalctl.c:932)
==17017==    by 0x1160B4: main (journalctl.c:1820)
==17017== 
==17017== Conditional jump or move depends on uninitialised value(s)
==17017==    at 0x16B6C5: greedy_realloc (util.c:5995)
==17017==    by 0x11262B: get_boots (journalctl.c:868)
==17017==    by 0x1128ED: list_boots (journalctl.c:932)
==17017==    by 0x1160B4: main (journalctl.c:1820)
==17017== 
==17017== Conditional jump or move depends on uninitialised value(s)
==17017==    at 0x4C28BCD: malloc (vg_replace_malloc.c:296)
==17017==    by 0x4C2AFCF: realloc (vg_replace_malloc.c:692)
==17017==    by 0x16B6E3: greedy_realloc (util.c:5998)
==17017==    by 0x11262B: get_boots (journalctl.c:868)
==17017==    by 0x1128ED: list_boots (journalctl.c:932)
==17017==    by 0x1160B4: main (journalctl.c:1820)

...

Zbyszek


More information about the systemd-devel mailing list