[pacman-dev] [PATCH 1/2] lib/dload: prevent possible NULL dereference

Lukas Fleischer archlinux at cryptocrack.de
Thu Aug 18 15:41:09 EDT 2011


On Thu, Aug 18, 2011 at 01:57:33PM -0400, Dave Reisner wrote:
> Signed-off-by: Dave Reisner <dreisner at archlinux.org>
> ---
> Our (my) download code isn't very clear, but there's an oddball chance this
> might happen. Pointed out by Lucas.

Still a bit hackish, but definitely looks better than mine :)

Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>

> 
>  lib/libalpm/dload.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
> index 5464740..3798937 100644
> --- a/lib/libalpm/dload.c
> +++ b/lib/libalpm/dload.c
> @@ -396,7 +396,7 @@ cleanup:
>  		}
>  	}
>  
> -	if((ret == -1 || dload_interrupted) && should_unlink) {
> +	if((ret == -1 || dload_interrupted) && should_unlink && tempfile) {
>  		unlink(tempfile);
>  	}
>  
> -- 
> 1.7.6


More information about the pacman-dev mailing list