In ImageMagick 7.0.7-12 Q16, there are memory leaks in MontageImageCommand in MagickWand/montage.c. https://nvd.nist.gov/vuln/detail/CVE-2017-18022