Pull the useful part of p9-132414 over to "donut".

This was inspired by some valgrind complaints marcone noticed.  The change
is already part of "master".

(I just noticed that the comment isn't quite right, but hopefully if I leave
it alone it'll merge trivially and I can fix it up in a subsequent change.)
1 file changed