Fix memory leak caused by incorrect link count to clean up on error.

6 jobs for memleak-fix1 in 1 minute and 13 seconds (queued for 84 minutes and 54 seconds)
latest
Status Job ID Name Coverage
  Build
passed #10689
docker
autotools

00:01:13

passed #10690
docker
doc

00:00:35

passed #10691
docker
makefile

00:00:22

failed #10686
docker
autotools

failed #10688
docker
doc

failed #10687
docker
makefile