[pacman-dev] [PATCH 1/2] Attempted to free lock on failure in alpm_db_update()

Andrew Gregory andrew.gregory.8 at gmail.com
Thu Dec 19 03:23:29 UTC 2019


On 12/19/19 at 11:17am, Allan McRae wrote:
> On 17/12/19 5:13 pm, Andrew Gregory wrote:
> > s/Attempted to//?
> > 
> > On 12/17/19 at 01:04am, Allan McRae wrote:
> >> Also fixes a memory leak under an error condition.
> >>
> >> Signed-off-by: Allan McRae <allan at archlinux.org>
> >> ---
> >>  lib/libalpm/be_sync.c | 18 ++++++++++--------
> >>  1 file changed, 10 insertions(+), 8 deletions(-)
> >>
> >> diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
> >> index 041b2266..5502d92d 100644
> >> --- a/lib/libalpm/be_sync.c
> >> +++ b/lib/libalpm/be_sync.c
> > ...
> >> @@ -324,6 +325,7 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
> >>  		}
> >>  	}
> >>  
> >> +cleanup:
> > 
> > Shouldn't this be before the previous if(updated){...} block?
> 
> It could be...   No need to drop the cache and reset validation if we
> are restoring the old database, but it does not hurt.

That doesn't happen until patch 2 though.  If they're going to be
split into separate patches, this patch should be able to stand on its
own.  It's unlikely, but the restoration could also fail, causing
a package list to be loaded from an invalid database.


More information about the pacman-dev mailing list