[feature] Use a dynamic buffer for xi_mqtt_layer_data_ready
Improve readability

Unimportant changes
[fix] Release memory on MQTT_SERIALISER_RC_ERROR
[fix] Do not release buffer memory on EAGAIN
[fix] memory leak when the layer is disconnected

This situation may happen whenever the client is disconnected while sending a message
[fix] Release memory on err_handling.

We also need to declare both pointers before allocating any of them, just in case we run out of memory while allocating the first and try to use the second one in the subroutine.
Merge pull request #117 from xively/feat_dynamic_buffer

[feature] Use a dynamic buffer for xi_mqtt_layer_data_ready