bugfix: small memory leak in imfile when $ResetConfigVariables was used

Thanks to Grégory Nuyttens for reporting this bug and providig a fix
Merge branch 'v7-stable'