Bump the SO_VERSION to 1

Commit a9282329c3 changed the layout of the RTMP struct, making
it ABI-incompatible with previous versions.
Correct the count of bytes written to the initial FLV buffer

This matters if the buffer overflows, when the count is used
for patching the buffer back together. This happens if there
are multiple video packets with zero timestamp at the start
of the stream (before any audio packets), enough to fill the buffer.
Free the extra read buffer if the initial FLV buffer overflowed

This fixes a leak in this cornercase.
Fix leaks in AMF objects that contain arrays