[pacman-dev] [PATCH 2/4] query_fileowner, mdirname: add error checks

Allan McRae allan at archlinux.org
Mon Aug 27 03:24:48 EDT 2012


On 12/08/12 07:35, Andrew Gregory wrote:
> Also consolidates cleanup for query_fileowner.
> 
> Signed-off-by: Andrew Gregory <andrew.gregory.8 at gmail.com>
> ---
>  src/pacman/query.c | 28 ++++++++++++++--------------
>  src/pacman/util.c  |  5 ++++-
>  2 files changed, 18 insertions(+), 15 deletions(-)
> 

<snip>

> diff --git a/src/pacman/util.c b/src/pacman/util.c
> index 2d1b762..ba7a8c0 100644
> --- a/src/pacman/util.c
> +++ b/src/pacman/util.c
> @@ -239,7 +239,10 @@ char *mdirname(const char *path)
>  		return strdup(".");
>  	}
>  
> -	ret = strdup(path);
> +	if((ret = strdup(path)) == NULL) {
> +			return NULL;

Whitespace error.   Fixed on my working branch.

> +	}
> +
>  	last = strrchr(ret, '/');
>  
>  	if(last != NULL) {
> 



More information about the pacman-dev mailing list