Memory leaks fixes

Several fixes for raster and symbology memory leaks. Also a fix to CMake as some raster headers are missing when working with qgis API.