[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: [PATCH] watch: don't leak cmd (-8 bytes; -16 on arm)
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2010-10-22 14:59:57
Message-ID: AANLkTimV7GPfq5gGbzHGbEBhgegoKmzj08MW_-hdm7SB () mail ! gmail ! com
[Download RAW message or body]

On Fri, Oct 22, 2010 at 3:38 PM, Alexander Shishkin <virtuoso@slind.org> wrote:
> Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
> ---
>  procps/watch.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/procps/watch.c b/procps/watch.c
> index 36f71c4..0d1118d 100644
> --- a/procps/watch.c
> +++ b/procps/watch.c
> @@ -47,7 +47,7 @@ int watch_main(int argc UNUSED_PARAM, char **argv)
>        // watch ls -l "a /tmp" "2>&1" - ls won't see "a /tmp" as one param
>        cmd = *argv;
>        while (*++argv)
> -               cmd = xasprintf("%s %s", cmd, *argv); // leaks cmd
> +               *(*argv - 1) = ' ';

Bug. getopt reorders argv[].

-- 
vda
_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic