out_cloudwatch_logs: Fix invalid memory access bug #4425
out_cloudwatch_logs: Fix invalid memory access bug #4425

msgpack objects that contain strings or arrays are only valid as long as the
underlying buffer and the unpacked result exist. This fix separates out the
memory allocation from the function that creates a msgpack object from a
custom structure.
The fix was validated using valgrind.

Signed-off-by: Ramya Krishnamoorthy <bc89eb55733118f1c5fbef6a7388dc127c67c70a@users.noreply.github.com>

fluent/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,fluent/fluent-bit,nokute78/fluent-bit,fluent/fluent-bit,fluent/fluent-bit