Fixed #6252 (False positive "freed twice")

--HG--
extra : rebase_source : 24f801452fbefa3a59ab2cca62c3cf02aea513b6