In gdImageScaleTwoPass() a tmp_im is [created with gdImageCreateTrueColor()](https://github.com/libgd/libgd/blob/master/src/gd_interpolation.c#L1067), but later [freed with gdFree()](https://github.com/libgd/libgd/blob/master/src/gd_interpolation.c#L1090) instead of gdImageDestroy(). This is likely to cause a memory leak. See also the [related downstream bug report](https://bugs.php.net/bug.php?id=70064).
In gdImageScaleTwoPass() a tmp_im is created with gdImageCreateTrueColor(), but later freed with gdFree() instead of gdImageDestroy(). This is likely to cause a memory leak.
See also the related downstream bug report.