upstream commit

tweak previous;
upstream commit

plug a memory leak; from Maxime Villard.

ok djm@