[pacman-dev] [PATCH 1/4] pacman.c: Remove redundant strdup() in parsearg_global()

Dan McGee dpmcgee at gmail.com
Sun Aug 28 20:48:20 EDT 2011


On Fri, Aug 26, 2011 at 6:10 AM, Lukas Fleischer
<archlinux at cryptocrack.de> wrote:
> config_set_arch() already calls strdup(). Remove strdup() from the
> config_set_arch() invocation to avoid a memory leak.
>
> Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
Thanks.
> ---
>  src/pacman/pacman.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
> index 71413bd..d285a05 100644
> --- a/src/pacman/pacman.c
> +++ b/src/pacman/pacman.c
> @@ -385,7 +385,7 @@ static int parsearg_global(int opt)
>        switch(opt) {
>                case OP_ARCH:
>                        check_optarg();
> -                       config_set_arch(strdup(optarg));
> +                       config_set_arch(optarg);
>                        break;
>                case OP_ASK:
>                        check_optarg();
> --
> 1.7.6.1
>
>
>


More information about the pacman-dev mailing list