Fix memory consumption when reading compressed recursive data
Fix memory consumption when reading compressed recursive data

 * Read data earlier if less in size than the zlib inflate state (approximately)
 * Call inflateEnd earlier if possible
 * As reported by https://sourceforge.net/p/matio/bugs/29/

NJannasch/matio,MaartenBent/matio,MaartenBent/matio,tbeu/matio,MaartenBent/matio,tbeu/matio,MaartenBent/matio,NJannasch/matio,tbeu/matio,tbeu/matio