use CPLFree on memory allocated by GDAL (fixes #7008)