fixed some memory leaks in buffer allocation, improved memory handling in pipeline (buffers should be freed when pipeline re-creates passes)