Buffer fixes

Fixes memory usage after free and an issue with Py_Buffer being filled in a self referencing way making it impossible to copy it. Also there was something wrong with the whitespace stripping, so I took the liberty to fix that.

I know, striking lack of tests. Input very welcome, since it is not straight forward to me (except for the python 2.6 segfault in the issue).