[systemd-devel] [PATCH] fix memory leak when bailing out

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Tue Dec 4 05:05:51 PST 2012


On Mon, Dec 03, 2012 at 07:44:56PM -0200, Mauro Dreissig wrote:
> ---
>  src/modules-load/modules-load.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
> index e72e382..0492831 100644
> --- a/src/modules-load/modules-load.c
> +++ b/src/modules-load/modules-load.c
> @@ -89,15 +89,19 @@ static int parse_proc_cmdline(void) {
>                  if (startswith(word, "modules-load=")) {
>  
>                          r = add_modules(word + 13);
> -                        if (r < 0)
> +                        if (r < 0) {
> +                                free(word);
>                                  goto finish;
> +                        }
Hi,
applied a different fix: we now have _cleanup_free_ to avoid explicit
free'ing.

Zbyszek


More information about the systemd-devel mailing list