[systemd-devel] [PATCH 4/5] systemd-analyze: free unit_times only if it is not NULL

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Fri Mar 1 13:45:52 PST 2013


On Fri, Mar 01, 2013 at 06:30:00PM +0100, Lukas Nykryn wrote:
> ---
>  src/analyze/systemd-analyze.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/src/analyze/systemd-analyze.c b/src/analyze/systemd-analyze.c
> index b7e1670..7603cc0 100644
> --- a/src/analyze/systemd-analyze.c
> +++ b/src/analyze/systemd-analyze.c
> @@ -237,9 +237,11 @@ static int acquire_time_data(DBusConnection *bus, struct unit_times **out)
>          *out = unit_times;
>          return c;
>  fail:
> -        for (; c >= 0; c--)
> -                free(unit_times[c].name);
> -        free(unit_times);
> +        if (unit_times) {
> +                for (; c >= 0; c--)
> +                        free(unit_times[c].name);
> +                free(unit_times);
> +        }
>          return r;
>  }
Applied.

Zbyszek


More information about the systemd-devel mailing list