RUBY-611 fixing usage of buffer after deallocation