[pacman-dev] [PATCH 3/4] be_sync.c: Fix memory leak in alpm_db_update()

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


On Fri, Aug 26, 2011 at 6:10 AM, Lukas Fleischer
<archlinux at cryptocrack.de> wrote:
> Free "syncpath" and restore umask if we fail to grab a lock.
>
> Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
Thanks.
> ---
>  lib/libalpm/be_sync.c |    2 ++
>  1 files changed, 2 insertions(+), 0 deletions(-)
>
> diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
> index 6e64e5f..5e53798 100644
> --- a/lib/libalpm/be_sync.c
> +++ b/lib/libalpm/be_sync.c
> @@ -176,6 +176,8 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
>
>        /* attempt to grab a lock */
>        if(_alpm_handle_lock(handle)) {
> +               free(syncpath);
> +               umask(oldmask);
>                RET_ERR(handle, ALPM_ERR_HANDLE_LOCK, -1);
>        }
>
> --
> 1.7.6.1
>
>
>


More information about the pacman-dev mailing list