[pacman-dev] [PATCH] Add check for NULL data parameter in sync commit

Nagy Gabor ngaba at bibl.u-szeged.hu
Sun Dec 23 08:05:14 EST 2007


> diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
> index 7661866..0a8170c 100644
> --- a/lib/libalpm/sync.c
> +++ b/lib/libalpm/sync.c
> @@ -675,7 +675,9 @@ int _alpm_sync_prepare(pmtrans_t *trans, pmdb_t
> *db_local, alpm_list_t *dbs_sync if(deps) {
>  			pm_errno = PM_ERR_UNSATISFIED_DEPS;
>  			ret = -1;
> -			*data = deps;
> +			if(data) {
> +				*data = deps;
> +			}
>  			goto cleanup;
>  		}
>  	}
Some little comments: If you don't keep the result, you should free
deps list with FREELIST().

And the same for the allocated errormsg strings <- here you can put the
whole {calloc, snprintf, alpm_list_add} block to if(data).

Bye




More information about the pacman-dev mailing list