status: Fix space leak in local mode, introduced in version 4.20130920.

Actually fixed 2 leaks, the tuple leak may have been older.
This commit is contained in:
Joey Hess 2013-10-07 02:48:39 -04:00
parent 5acb47fb7c
commit 1200788859
2 changed files with 11 additions and 9 deletions

View file

@ -311,15 +311,16 @@ getLocalStatInfo dir = do
initial = (emptyKeyData, emptyKeyData, emptyNumCopiesStats) initial = (emptyKeyData, emptyKeyData, emptyNumCopiesStats)
update matcher fast key file vs@(presentdata, referenceddata, numcopiesstats) = update matcher fast key file vs@(presentdata, referenceddata, numcopiesstats) =
ifM (matcher $ FileInfo file file) ifM (matcher $ FileInfo file file)
( (,,) ( do
<$> ifM (inAnnex key) !presentdata' <- ifM (inAnnex key)
( return $ addKey key presentdata ( return $ addKey key presentdata
, return presentdata , return presentdata
) )
<*> pure (addKey key referenceddata) let !referenceddata' = addKey key referenceddata
<*> if fast !numcopiesstats' <- if fast
then return numcopiesstats then return numcopiesstats
else updateNumCopiesStats key file numcopiesstats else updateNumCopiesStats key file numcopiesstats
return $! (presentdata', referenceddata', numcopiesstats')
, return vs , return vs
) )
@ -345,11 +346,11 @@ addKey key (KeyData count size unknownsize backends) =
ks = keySize key ks = keySize key
updateNumCopiesStats :: Key -> FilePath -> NumCopiesStats -> Annex NumCopiesStats updateNumCopiesStats :: Key -> FilePath -> NumCopiesStats -> Annex NumCopiesStats
updateNumCopiesStats key file stats = do updateNumCopiesStats key file (NumCopiesStats m) = do
variance <- Variance <$> numCopiesCheck file key (-) !variance <- Variance <$> numCopiesCheck file key (-)
return $ stats { numCopiesVarianceMap = update (numCopiesVarianceMap stats) variance } let !m' = M.insertWith' (+) variance 1 m
where let !ret = NumCopiesStats m'
update m variance = M.insertWith' (+) variance 1 m return ret
showSizeKeys :: KeyData -> String showSizeKeys :: KeyData -> String
showSizeKeys d = total ++ missingnote showSizeKeys d = total ++ missingnote

1
debian/changelog vendored
View file

@ -10,6 +10,7 @@ git-annex (4.20131003) UNRELEASED; urgency=low
* The control socket path passed to ssh needs to be 17 characters * The control socket path passed to ssh needs to be 17 characters
shorter than the maximum unix domain socket length, because ssh shorter than the maximum unix domain socket length, because ssh
appends stuff to it to make a temporary filename. Closes: #725512 appends stuff to it to make a temporary filename. Closes: #725512
* status: Fix space leak in local mode, introduced in version 4.20130920.
-- Joey Hess <joeyh@debian.org> Thu, 03 Oct 2013 15:41:24 -0400 -- Joey Hess <joeyh@debian.org> Thu, 03 Oct 2013 15:41:24 -0400