A small memory footprint AMQP implimentation

Dependents:   iothub_client_sample_amqp remote_monitoring simplesample_amqp

Revision:
25:1101516ee67d
Parent:
23:1111ee8bcba4
Child:
28:add19eb7defa
--- a/amqp_definitions.c	Mon May 08 10:50:45 2017 -0700
+++ b/amqp_definitions.c	Mon May 22 10:35:21 2017 -0700
@@ -11,6 +11,8 @@
 #include <stdlib.h>
 #include <stdbool.h>
 
+#pragma warning (disable : 4127)
+
 /* role */
 
 AMQP_VALUE amqpvalue_create_role(role value)
@@ -254,17 +256,19 @@
 				        }
 				        else
 				        {
-					        const char* condition;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        error_destroy(*error_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            const char* condition;
 					            if (amqpvalue_get_symbol(item_value, &condition) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            error_destroy(*error_handle);
 						            result = __FAILURE__;
 						            break;
@@ -288,15 +292,16 @@
 				        }
 				        else
 				        {
-					        const char* description;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* description;
 					            if (amqpvalue_get_string(item_value, &description) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            error_destroy(*error_handle);
 						            result = __FAILURE__;
 						            break;
@@ -316,15 +321,16 @@
 				        }
 				        else
 				        {
-					        fields info;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            fields info;
 					            if (amqpvalue_get_fields(item_value, &info) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            error_destroy(*error_handle);
 						            result = __FAILURE__;
 						            break;
@@ -773,17 +779,19 @@
 				        }
 				        else
 				        {
-					        const char* container_id;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        open_destroy(*open_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            const char* container_id;
 					            if (amqpvalue_get_string(item_value, &container_id) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            open_destroy(*open_handle);
 						            result = __FAILURE__;
 						            break;
@@ -807,15 +815,16 @@
 				        }
 				        else
 				        {
-					        const char* hostname;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* hostname;
 					            if (amqpvalue_get_string(item_value, &hostname) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            open_destroy(*open_handle);
 						            result = __FAILURE__;
 						            break;
@@ -835,15 +844,16 @@
 				        }
 				        else
 				        {
-					        uint32_t max_frame_size;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            uint32_t max_frame_size;
 					            if (amqpvalue_get_uint(item_value, &max_frame_size) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            open_destroy(*open_handle);
 						            result = __FAILURE__;
 						            break;
@@ -863,15 +873,16 @@
 				        }
 				        else
 				        {
-					        uint16_t channel_max;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            uint16_t channel_max;
 					            if (amqpvalue_get_ushort(item_value, &channel_max) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            open_destroy(*open_handle);
 						            result = __FAILURE__;
 						            break;
@@ -891,15 +902,16 @@
 				        }
 				        else
 				        {
-					        milliseconds idle_time_out;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            milliseconds idle_time_out;
 					            if (amqpvalue_get_milliseconds(item_value, &idle_time_out) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            open_destroy(*open_handle);
 						            result = __FAILURE__;
 						            break;
@@ -919,17 +931,18 @@
 				        }
 				        else
 				        {
-					        ietf_language_tag outgoing_locales;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            ietf_language_tag outgoing_locales = NULL;
 					            AMQP_VALUE outgoing_locales_array;
 					            if ((amqpvalue_get_array(item_value, &outgoing_locales_array) != 0) &&
 						            (amqpvalue_get_ietf_language_tag(item_value, &outgoing_locales) != 0))
 					            {
+						            amqpvalue_destroy(item_value);
 						            open_destroy(*open_handle);
 						            result = __FAILURE__;
 						            break;
@@ -949,17 +962,18 @@
 				        }
 				        else
 				        {
-					        ietf_language_tag incoming_locales;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            ietf_language_tag incoming_locales = NULL;
 					            AMQP_VALUE incoming_locales_array;
 					            if ((amqpvalue_get_array(item_value, &incoming_locales_array) != 0) &&
 						            (amqpvalue_get_ietf_language_tag(item_value, &incoming_locales) != 0))
 					            {
+						            amqpvalue_destroy(item_value);
 						            open_destroy(*open_handle);
 						            result = __FAILURE__;
 						            break;
@@ -979,17 +993,18 @@
 				        }
 				        else
 				        {
-					        const char* offered_capabilities;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* offered_capabilities = NULL;
 					            AMQP_VALUE offered_capabilities_array;
 					            if ((amqpvalue_get_array(item_value, &offered_capabilities_array) != 0) &&
 						            (amqpvalue_get_symbol(item_value, &offered_capabilities) != 0))
 					            {
+						            amqpvalue_destroy(item_value);
 						            open_destroy(*open_handle);
 						            result = __FAILURE__;
 						            break;
@@ -1009,17 +1024,18 @@
 				        }
 				        else
 				        {
-					        const char* desired_capabilities;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* desired_capabilities = NULL;
 					            AMQP_VALUE desired_capabilities_array;
 					            if ((amqpvalue_get_array(item_value, &desired_capabilities_array) != 0) &&
 						            (amqpvalue_get_symbol(item_value, &desired_capabilities) != 0))
 					            {
+						            amqpvalue_destroy(item_value);
 						            open_destroy(*open_handle);
 						            result = __FAILURE__;
 						            break;
@@ -1039,15 +1055,16 @@
 				        }
 				        else
 				        {
-					        fields properties;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            fields properties;
 					            if (amqpvalue_get_fields(item_value, &properties) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            open_destroy(*open_handle);
 						            result = __FAILURE__;
 						            break;
@@ -2104,15 +2121,16 @@
 				        }
 				        else
 				        {
-					        uint16_t remote_channel;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            uint16_t remote_channel;
 					            if (amqpvalue_get_ushort(item_value, &remote_channel) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            begin_destroy(*begin_handle);
 						            result = __FAILURE__;
 						            break;
@@ -2136,17 +2154,19 @@
 				        }
 				        else
 				        {
-					        transfer_number next_outgoing_id;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        begin_destroy(*begin_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            transfer_number next_outgoing_id;
 					            if (amqpvalue_get_transfer_number(item_value, &next_outgoing_id) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            begin_destroy(*begin_handle);
 						            result = __FAILURE__;
 						            break;
@@ -2174,17 +2194,19 @@
 				        }
 				        else
 				        {
-					        uint32_t incoming_window;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        begin_destroy(*begin_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            uint32_t incoming_window;
 					            if (amqpvalue_get_uint(item_value, &incoming_window) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            begin_destroy(*begin_handle);
 						            result = __FAILURE__;
 						            break;
@@ -2212,17 +2234,19 @@
 				        }
 				        else
 				        {
-					        uint32_t outgoing_window;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        begin_destroy(*begin_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            uint32_t outgoing_window;
 					            if (amqpvalue_get_uint(item_value, &outgoing_window) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            begin_destroy(*begin_handle);
 						            result = __FAILURE__;
 						            break;
@@ -2246,15 +2270,16 @@
 				        }
 				        else
 				        {
-					        handle handle_max;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            handle handle_max;
 					            if (amqpvalue_get_handle(item_value, &handle_max) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            begin_destroy(*begin_handle);
 						            result = __FAILURE__;
 						            break;
@@ -2274,17 +2299,18 @@
 				        }
 				        else
 				        {
-					        const char* offered_capabilities;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* offered_capabilities = NULL;
 					            AMQP_VALUE offered_capabilities_array;
 					            if ((amqpvalue_get_array(item_value, &offered_capabilities_array) != 0) &&
 						            (amqpvalue_get_symbol(item_value, &offered_capabilities) != 0))
 					            {
+						            amqpvalue_destroy(item_value);
 						            begin_destroy(*begin_handle);
 						            result = __FAILURE__;
 						            break;
@@ -2304,17 +2330,18 @@
 				        }
 				        else
 				        {
-					        const char* desired_capabilities;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* desired_capabilities = NULL;
 					            AMQP_VALUE desired_capabilities_array;
 					            if ((amqpvalue_get_array(item_value, &desired_capabilities_array) != 0) &&
 						            (amqpvalue_get_symbol(item_value, &desired_capabilities) != 0))
 					            {
+						            amqpvalue_destroy(item_value);
 						            begin_destroy(*begin_handle);
 						            result = __FAILURE__;
 						            break;
@@ -2334,15 +2361,16 @@
 				        }
 				        else
 				        {
-					        fields properties;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            fields properties;
 					            if (amqpvalue_get_fields(item_value, &properties) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            begin_destroy(*begin_handle);
 						            result = __FAILURE__;
 						            break;
@@ -3213,17 +3241,19 @@
 				        }
 				        else
 				        {
-					        const char* name;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        attach_destroy(*attach_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            const char* name;
 					            if (amqpvalue_get_string(item_value, &name) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            attach_destroy(*attach_handle);
 						            result = __FAILURE__;
 						            break;
@@ -3251,17 +3281,19 @@
 				        }
 				        else
 				        {
-					        handle handle;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        attach_destroy(*attach_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            handle handle;
 					            if (amqpvalue_get_handle(item_value, &handle) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            attach_destroy(*attach_handle);
 						            result = __FAILURE__;
 						            break;
@@ -3289,17 +3321,19 @@
 				        }
 				        else
 				        {
-					        role role;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        attach_destroy(*attach_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            role role;
 					            if (amqpvalue_get_role(item_value, &role) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            attach_destroy(*attach_handle);
 						            result = __FAILURE__;
 						            break;
@@ -3323,15 +3357,16 @@
 				        }
 				        else
 				        {
-					        sender_settle_mode snd_settle_mode;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            sender_settle_mode snd_settle_mode;
 					            if (amqpvalue_get_sender_settle_mode(item_value, &snd_settle_mode) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            attach_destroy(*attach_handle);
 						            result = __FAILURE__;
 						            break;
@@ -3351,15 +3386,16 @@
 				        }
 				        else
 				        {
-					        receiver_settle_mode rcv_settle_mode;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            receiver_settle_mode rcv_settle_mode;
 					            if (amqpvalue_get_receiver_settle_mode(item_value, &rcv_settle_mode) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            attach_destroy(*attach_handle);
 						            result = __FAILURE__;
 						            break;
@@ -3405,15 +3441,16 @@
 				        }
 				        else
 				        {
-					        AMQP_VALUE unsettled;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            AMQP_VALUE unsettled;
 					            if (amqpvalue_get_map(item_value, &unsettled) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            attach_destroy(*attach_handle);
 						            result = __FAILURE__;
 						            break;
@@ -3433,15 +3470,16 @@
 				        }
 				        else
 				        {
-					        bool incomplete_unsettled;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool incomplete_unsettled;
 					            if (amqpvalue_get_boolean(item_value, &incomplete_unsettled) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            attach_destroy(*attach_handle);
 						            result = __FAILURE__;
 						            break;
@@ -3461,15 +3499,16 @@
 				        }
 				        else
 				        {
-					        sequence_no initial_delivery_count;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            sequence_no initial_delivery_count;
 					            if (amqpvalue_get_sequence_no(item_value, &initial_delivery_count) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            attach_destroy(*attach_handle);
 						            result = __FAILURE__;
 						            break;
@@ -3489,15 +3528,16 @@
 				        }
 				        else
 				        {
-					        uint64_t max_message_size;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            uint64_t max_message_size;
 					            if (amqpvalue_get_ulong(item_value, &max_message_size) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            attach_destroy(*attach_handle);
 						            result = __FAILURE__;
 						            break;
@@ -3517,17 +3557,18 @@
 				        }
 				        else
 				        {
-					        const char* offered_capabilities;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* offered_capabilities = NULL;
 					            AMQP_VALUE offered_capabilities_array;
 					            if ((amqpvalue_get_array(item_value, &offered_capabilities_array) != 0) &&
 						            (amqpvalue_get_symbol(item_value, &offered_capabilities) != 0))
 					            {
+						            amqpvalue_destroy(item_value);
 						            attach_destroy(*attach_handle);
 						            result = __FAILURE__;
 						            break;
@@ -3547,17 +3588,18 @@
 				        }
 				        else
 				        {
-					        const char* desired_capabilities;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* desired_capabilities = NULL;
 					            AMQP_VALUE desired_capabilities_array;
 					            if ((amqpvalue_get_array(item_value, &desired_capabilities_array) != 0) &&
 						            (amqpvalue_get_symbol(item_value, &desired_capabilities) != 0))
 					            {
+						            amqpvalue_destroy(item_value);
 						            attach_destroy(*attach_handle);
 						            result = __FAILURE__;
 						            break;
@@ -3577,15 +3619,16 @@
 				        }
 				        else
 				        {
-					        fields properties;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            fields properties;
 					            if (amqpvalue_get_fields(item_value, &properties) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            attach_destroy(*attach_handle);
 						            result = __FAILURE__;
 						            break;
@@ -4976,15 +5019,16 @@
 				        }
 				        else
 				        {
-					        transfer_number next_incoming_id;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            transfer_number next_incoming_id;
 					            if (amqpvalue_get_transfer_number(item_value, &next_incoming_id) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            flow_destroy(*flow_handle);
 						            result = __FAILURE__;
 						            break;
@@ -5008,17 +5052,19 @@
 				        }
 				        else
 				        {
-					        uint32_t incoming_window;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        flow_destroy(*flow_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            uint32_t incoming_window;
 					            if (amqpvalue_get_uint(item_value, &incoming_window) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            flow_destroy(*flow_handle);
 						            result = __FAILURE__;
 						            break;
@@ -5046,17 +5092,19 @@
 				        }
 				        else
 				        {
-					        transfer_number next_outgoing_id;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        flow_destroy(*flow_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            transfer_number next_outgoing_id;
 					            if (amqpvalue_get_transfer_number(item_value, &next_outgoing_id) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            flow_destroy(*flow_handle);
 						            result = __FAILURE__;
 						            break;
@@ -5084,17 +5132,19 @@
 				        }
 				        else
 				        {
-					        uint32_t outgoing_window;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        flow_destroy(*flow_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            uint32_t outgoing_window;
 					            if (amqpvalue_get_uint(item_value, &outgoing_window) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            flow_destroy(*flow_handle);
 						            result = __FAILURE__;
 						            break;
@@ -5118,15 +5168,16 @@
 				        }
 				        else
 				        {
-					        handle handle;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            handle handle;
 					            if (amqpvalue_get_handle(item_value, &handle) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            flow_destroy(*flow_handle);
 						            result = __FAILURE__;
 						            break;
@@ -5146,15 +5197,16 @@
 				        }
 				        else
 				        {
-					        sequence_no delivery_count;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            sequence_no delivery_count;
 					            if (amqpvalue_get_sequence_no(item_value, &delivery_count) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            flow_destroy(*flow_handle);
 						            result = __FAILURE__;
 						            break;
@@ -5174,15 +5226,16 @@
 				        }
 				        else
 				        {
-					        uint32_t link_credit;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            uint32_t link_credit;
 					            if (amqpvalue_get_uint(item_value, &link_credit) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            flow_destroy(*flow_handle);
 						            result = __FAILURE__;
 						            break;
@@ -5202,15 +5255,16 @@
 				        }
 				        else
 				        {
-					        uint32_t available;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            uint32_t available;
 					            if (amqpvalue_get_uint(item_value, &available) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            flow_destroy(*flow_handle);
 						            result = __FAILURE__;
 						            break;
@@ -5230,15 +5284,16 @@
 				        }
 				        else
 				        {
-					        bool drain;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool drain;
 					            if (amqpvalue_get_boolean(item_value, &drain) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            flow_destroy(*flow_handle);
 						            result = __FAILURE__;
 						            break;
@@ -5258,15 +5313,16 @@
 				        }
 				        else
 				        {
-					        bool echo;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool echo;
 					            if (amqpvalue_get_boolean(item_value, &echo) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            flow_destroy(*flow_handle);
 						            result = __FAILURE__;
 						            break;
@@ -5286,15 +5342,16 @@
 				        }
 				        else
 				        {
-					        fields properties;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            fields properties;
 					            if (amqpvalue_get_fields(item_value, &properties) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            flow_destroy(*flow_handle);
 						            result = __FAILURE__;
 						            break;
@@ -6391,17 +6448,19 @@
 				        }
 				        else
 				        {
-					        handle handle;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        transfer_destroy(*transfer_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            handle handle;
 					            if (amqpvalue_get_handle(item_value, &handle) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            transfer_destroy(*transfer_handle);
 						            result = __FAILURE__;
 						            break;
@@ -6425,15 +6484,16 @@
 				        }
 				        else
 				        {
-					        delivery_number delivery_id;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            delivery_number delivery_id;
 					            if (amqpvalue_get_delivery_number(item_value, &delivery_id) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            transfer_destroy(*transfer_handle);
 						            result = __FAILURE__;
 						            break;
@@ -6453,15 +6513,16 @@
 				        }
 				        else
 				        {
-					        delivery_tag delivery_tag;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            delivery_tag delivery_tag;
 					            if (amqpvalue_get_delivery_tag(item_value, &delivery_tag) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            transfer_destroy(*transfer_handle);
 						            result = __FAILURE__;
 						            break;
@@ -6481,15 +6542,16 @@
 				        }
 				        else
 				        {
-					        message_format message_format;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            message_format message_format;
 					            if (amqpvalue_get_message_format(item_value, &message_format) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            transfer_destroy(*transfer_handle);
 						            result = __FAILURE__;
 						            break;
@@ -6509,15 +6571,16 @@
 				        }
 				        else
 				        {
-					        bool settled;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool settled;
 					            if (amqpvalue_get_boolean(item_value, &settled) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            transfer_destroy(*transfer_handle);
 						            result = __FAILURE__;
 						            break;
@@ -6537,15 +6600,16 @@
 				        }
 				        else
 				        {
-					        bool more;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool more;
 					            if (amqpvalue_get_boolean(item_value, &more) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            transfer_destroy(*transfer_handle);
 						            result = __FAILURE__;
 						            break;
@@ -6565,15 +6629,16 @@
 				        }
 				        else
 				        {
-					        receiver_settle_mode rcv_settle_mode;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            receiver_settle_mode rcv_settle_mode;
 					            if (amqpvalue_get_receiver_settle_mode(item_value, &rcv_settle_mode) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            transfer_destroy(*transfer_handle);
 						            result = __FAILURE__;
 						            break;
@@ -6606,15 +6671,16 @@
 				        }
 				        else
 				        {
-					        bool resume;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool resume;
 					            if (amqpvalue_get_boolean(item_value, &resume) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            transfer_destroy(*transfer_handle);
 						            result = __FAILURE__;
 						            break;
@@ -6634,15 +6700,16 @@
 				        }
 				        else
 				        {
-					        bool aborted;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool aborted;
 					            if (amqpvalue_get_boolean(item_value, &aborted) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            transfer_destroy(*transfer_handle);
 						            result = __FAILURE__;
 						            break;
@@ -6662,15 +6729,16 @@
 				        }
 				        else
 				        {
-					        bool batchable;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool batchable;
 					            if (amqpvalue_get_boolean(item_value, &batchable) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            transfer_destroy(*transfer_handle);
 						            result = __FAILURE__;
 						            break;
@@ -7796,17 +7864,19 @@
 				        }
 				        else
 				        {
-					        role role;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        disposition_destroy(*disposition_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            role role;
 					            if (amqpvalue_get_role(item_value, &role) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            disposition_destroy(*disposition_handle);
 						            result = __FAILURE__;
 						            break;
@@ -7834,17 +7904,19 @@
 				        }
 				        else
 				        {
-					        delivery_number first;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        disposition_destroy(*disposition_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            delivery_number first;
 					            if (amqpvalue_get_delivery_number(item_value, &first) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            disposition_destroy(*disposition_handle);
 						            result = __FAILURE__;
 						            break;
@@ -7868,15 +7940,16 @@
 				        }
 				        else
 				        {
-					        delivery_number last;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            delivery_number last;
 					            if (amqpvalue_get_delivery_number(item_value, &last) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            disposition_destroy(*disposition_handle);
 						            result = __FAILURE__;
 						            break;
@@ -7896,15 +7969,16 @@
 				        }
 				        else
 				        {
-					        bool settled;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool settled;
 					            if (amqpvalue_get_boolean(item_value, &settled) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            disposition_destroy(*disposition_handle);
 						            result = __FAILURE__;
 						            break;
@@ -7937,15 +8011,16 @@
 				        }
 				        else
 				        {
-					        bool batchable;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool batchable;
 					            if (amqpvalue_get_boolean(item_value, &batchable) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            disposition_destroy(*disposition_handle);
 						            result = __FAILURE__;
 						            break;
@@ -8634,17 +8709,19 @@
 				        }
 				        else
 				        {
-					        handle handle;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        detach_destroy(*detach_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            handle handle;
 					            if (amqpvalue_get_handle(item_value, &handle) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            detach_destroy(*detach_handle);
 						            result = __FAILURE__;
 						            break;
@@ -8668,15 +8745,16 @@
 				        }
 				        else
 				        {
-					        bool closed;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool closed;
 					            if (amqpvalue_get_boolean(item_value, &closed) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            detach_destroy(*detach_handle);
 						            result = __FAILURE__;
 						            break;
@@ -8696,19 +8774,24 @@
 				        }
 				        else
 				        {
-					        ERROR_HANDLE error;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            ERROR_HANDLE error;
 					            if (amqpvalue_get_error(item_value, &error) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            detach_destroy(*detach_handle);
 						            result = __FAILURE__;
 						            break;
 					            }
+                                else
+                                {
+						            error_destroy(error);
+                                }
                             }
 
 					        amqpvalue_destroy(item_value);
@@ -9118,19 +9201,24 @@
 				        }
 				        else
 				        {
-					        ERROR_HANDLE error;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            ERROR_HANDLE error;
 					            if (amqpvalue_get_error(item_value, &error) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            end_destroy(*end_handle);
 						            result = __FAILURE__;
 						            break;
 					            }
+                                else
+                                {
+						            error_destroy(error);
+                                }
                             }
 
 					        amqpvalue_destroy(item_value);
@@ -9366,19 +9454,24 @@
 				        }
 				        else
 				        {
-					        ERROR_HANDLE error;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            ERROR_HANDLE error;
 					            if (amqpvalue_get_error(item_value, &error) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            close_destroy(*close_handle);
 						            result = __FAILURE__;
 						            break;
 					            }
+                                else
+                                {
+						            error_destroy(error);
+                                }
                             }
 
 					        amqpvalue_destroy(item_value);
@@ -9638,19 +9731,21 @@
 				        }
 				        else
 				        {
-					        const char* sasl_server_mechanisms;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        sasl_mechanisms_destroy(*sasl_mechanisms_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            const char* sasl_server_mechanisms = NULL;
 					            AMQP_VALUE sasl_server_mechanisms_array;
 					            if ((amqpvalue_get_array(item_value, &sasl_server_mechanisms_array) != 0) &&
 						            (amqpvalue_get_symbol(item_value, &sasl_server_mechanisms) != 0))
 					            {
+						            amqpvalue_destroy(item_value);
 						            sasl_mechanisms_destroy(*sasl_mechanisms_handle);
 						            result = __FAILURE__;
 						            break;
@@ -9919,17 +10014,19 @@
 				        }
 				        else
 				        {
-					        const char* mechanism;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        sasl_init_destroy(*sasl_init_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            const char* mechanism;
 					            if (amqpvalue_get_symbol(item_value, &mechanism) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            sasl_init_destroy(*sasl_init_handle);
 						            result = __FAILURE__;
 						            break;
@@ -9953,15 +10050,16 @@
 				        }
 				        else
 				        {
-					        amqp_binary initial_response;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            amqp_binary initial_response;
 					            if (amqpvalue_get_binary(item_value, &initial_response) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            sasl_init_destroy(*sasl_init_handle);
 						            result = __FAILURE__;
 						            break;
@@ -9981,15 +10079,16 @@
 				        }
 				        else
 				        {
-					        const char* hostname;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* hostname;
 					            if (amqpvalue_get_string(item_value, &hostname) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            sasl_init_destroy(*sasl_init_handle);
 						            result = __FAILURE__;
 						            break;
@@ -10410,17 +10509,19 @@
 				        }
 				        else
 				        {
-					        amqp_binary challenge;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        sasl_challenge_destroy(*sasl_challenge_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            amqp_binary challenge;
 					            if (amqpvalue_get_binary(item_value, &challenge) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            sasl_challenge_destroy(*sasl_challenge_handle);
 						            result = __FAILURE__;
 						            break;
@@ -10681,17 +10782,19 @@
 				        }
 				        else
 				        {
-					        amqp_binary response;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        sasl_response_destroy(*sasl_response_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            amqp_binary response;
 					            if (amqpvalue_get_binary(item_value, &response) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            sasl_response_destroy(*sasl_response_handle);
 						            result = __FAILURE__;
 						            break;
@@ -10952,17 +11055,19 @@
 				        }
 				        else
 				        {
-					        sasl_code code;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        sasl_outcome_destroy(*sasl_outcome_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            sasl_code code;
 					            if (amqpvalue_get_sasl_code(item_value, &code) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            sasl_outcome_destroy(*sasl_outcome_handle);
 						            result = __FAILURE__;
 						            break;
@@ -10986,15 +11091,16 @@
 				        }
 				        else
 				        {
-					        amqp_binary additional_data;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            amqp_binary additional_data;
 					            if (amqpvalue_get_binary(item_value, &additional_data) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            sasl_outcome_destroy(*sasl_outcome_handle);
 						            result = __FAILURE__;
 						            break;
@@ -11357,15 +11463,16 @@
 				        }
 				        else
 				        {
-					        terminus_durability durable;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            terminus_durability durable;
 					            if (amqpvalue_get_terminus_durability(item_value, &durable) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            source_destroy(*source_handle);
 						            result = __FAILURE__;
 						            break;
@@ -11385,15 +11492,16 @@
 				        }
 				        else
 				        {
-					        terminus_expiry_policy expiry_policy;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            terminus_expiry_policy expiry_policy;
 					            if (amqpvalue_get_terminus_expiry_policy(item_value, &expiry_policy) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            source_destroy(*source_handle);
 						            result = __FAILURE__;
 						            break;
@@ -11413,15 +11521,16 @@
 				        }
 				        else
 				        {
-					        seconds timeout;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            seconds timeout;
 					            if (amqpvalue_get_seconds(item_value, &timeout) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            source_destroy(*source_handle);
 						            result = __FAILURE__;
 						            break;
@@ -11441,15 +11550,16 @@
 				        }
 				        else
 				        {
-					        bool dynamic;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool dynamic;
 					            if (amqpvalue_get_boolean(item_value, &dynamic) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            source_destroy(*source_handle);
 						            result = __FAILURE__;
 						            break;
@@ -11469,15 +11579,16 @@
 				        }
 				        else
 				        {
-					        node_properties dynamic_node_properties;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            node_properties dynamic_node_properties;
 					            if (amqpvalue_get_node_properties(item_value, &dynamic_node_properties) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            source_destroy(*source_handle);
 						            result = __FAILURE__;
 						            break;
@@ -11497,15 +11608,16 @@
 				        }
 				        else
 				        {
-					        const char* distribution_mode;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* distribution_mode;
 					            if (amqpvalue_get_symbol(item_value, &distribution_mode) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            source_destroy(*source_handle);
 						            result = __FAILURE__;
 						            break;
@@ -11525,15 +11637,16 @@
 				        }
 				        else
 				        {
-					        filter_set filter;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            filter_set filter;
 					            if (amqpvalue_get_filter_set(item_value, &filter) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            source_destroy(*source_handle);
 						            result = __FAILURE__;
 						            break;
@@ -11566,17 +11679,18 @@
 				        }
 				        else
 				        {
-					        const char* outcomes;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* outcomes = NULL;
 					            AMQP_VALUE outcomes_array;
 					            if ((amqpvalue_get_array(item_value, &outcomes_array) != 0) &&
 						            (amqpvalue_get_symbol(item_value, &outcomes) != 0))
 					            {
+						            amqpvalue_destroy(item_value);
 						            source_destroy(*source_handle);
 						            result = __FAILURE__;
 						            break;
@@ -11596,17 +11710,18 @@
 				        }
 				        else
 				        {
-					        const char* capabilities;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* capabilities = NULL;
 					            AMQP_VALUE capabilities_array;
 					            if ((amqpvalue_get_array(item_value, &capabilities_array) != 0) &&
 						            (amqpvalue_get_symbol(item_value, &capabilities) != 0))
 					            {
+						            amqpvalue_destroy(item_value);
 						            source_destroy(*source_handle);
 						            result = __FAILURE__;
 						            break;
@@ -12739,15 +12854,16 @@
 				        }
 				        else
 				        {
-					        terminus_durability durable;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            terminus_durability durable;
 					            if (amqpvalue_get_terminus_durability(item_value, &durable) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            target_destroy(*target_handle);
 						            result = __FAILURE__;
 						            break;
@@ -12767,15 +12883,16 @@
 				        }
 				        else
 				        {
-					        terminus_expiry_policy expiry_policy;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            terminus_expiry_policy expiry_policy;
 					            if (amqpvalue_get_terminus_expiry_policy(item_value, &expiry_policy) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            target_destroy(*target_handle);
 						            result = __FAILURE__;
 						            break;
@@ -12795,15 +12912,16 @@
 				        }
 				        else
 				        {
-					        seconds timeout;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            seconds timeout;
 					            if (amqpvalue_get_seconds(item_value, &timeout) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            target_destroy(*target_handle);
 						            result = __FAILURE__;
 						            break;
@@ -12823,15 +12941,16 @@
 				        }
 				        else
 				        {
-					        bool dynamic;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool dynamic;
 					            if (amqpvalue_get_boolean(item_value, &dynamic) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            target_destroy(*target_handle);
 						            result = __FAILURE__;
 						            break;
@@ -12851,15 +12970,16 @@
 				        }
 				        else
 				        {
-					        node_properties dynamic_node_properties;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            node_properties dynamic_node_properties;
 					            if (amqpvalue_get_node_properties(item_value, &dynamic_node_properties) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            target_destroy(*target_handle);
 						            result = __FAILURE__;
 						            break;
@@ -12879,17 +12999,18 @@
 				        }
 				        else
 				        {
-					        const char* capabilities;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* capabilities = NULL;
 					            AMQP_VALUE capabilities_array;
 					            if ((amqpvalue_get_array(item_value, &capabilities_array) != 0) &&
 						            (amqpvalue_get_symbol(item_value, &capabilities) != 0))
 					            {
+						            amqpvalue_destroy(item_value);
 						            target_destroy(*target_handle);
 						            result = __FAILURE__;
 						            break;
@@ -13713,15 +13834,16 @@
 				        }
 				        else
 				        {
-					        bool durable;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool durable;
 					            if (amqpvalue_get_boolean(item_value, &durable) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            header_destroy(*header_handle);
 						            result = __FAILURE__;
 						            break;
@@ -13741,15 +13863,16 @@
 				        }
 				        else
 				        {
-					        uint8_t priority;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            uint8_t priority;
 					            if (amqpvalue_get_ubyte(item_value, &priority) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            header_destroy(*header_handle);
 						            result = __FAILURE__;
 						            break;
@@ -13769,15 +13892,16 @@
 				        }
 				        else
 				        {
-					        milliseconds ttl;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            milliseconds ttl;
 					            if (amqpvalue_get_milliseconds(item_value, &ttl) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            header_destroy(*header_handle);
 						            result = __FAILURE__;
 						            break;
@@ -13797,15 +13921,16 @@
 				        }
 				        else
 				        {
-					        bool first_acquirer;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool first_acquirer;
 					            if (amqpvalue_get_boolean(item_value, &first_acquirer) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            header_destroy(*header_handle);
 						            result = __FAILURE__;
 						            break;
@@ -13825,15 +13950,16 @@
 				        }
 				        else
 				        {
-					        uint32_t delivery_count;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            uint32_t delivery_count;
 					            if (amqpvalue_get_uint(item_value, &delivery_count) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            header_destroy(*header_handle);
 						            result = __FAILURE__;
 						            break;
@@ -14790,15 +14916,16 @@
 				        }
 				        else
 				        {
-					        amqp_binary user_id;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            amqp_binary user_id;
 					            if (amqpvalue_get_binary(item_value, &user_id) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            properties_destroy(*properties_handle);
 						            result = __FAILURE__;
 						            break;
@@ -14831,15 +14958,16 @@
 				        }
 				        else
 				        {
-					        const char* subject;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* subject;
 					            if (amqpvalue_get_string(item_value, &subject) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            properties_destroy(*properties_handle);
 						            result = __FAILURE__;
 						            break;
@@ -14885,15 +15013,16 @@
 				        }
 				        else
 				        {
-					        const char* content_type;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* content_type;
 					            if (amqpvalue_get_symbol(item_value, &content_type) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            properties_destroy(*properties_handle);
 						            result = __FAILURE__;
 						            break;
@@ -14913,15 +15042,16 @@
 				        }
 				        else
 				        {
-					        const char* content_encoding;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* content_encoding;
 					            if (amqpvalue_get_symbol(item_value, &content_encoding) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            properties_destroy(*properties_handle);
 						            result = __FAILURE__;
 						            break;
@@ -14941,15 +15071,16 @@
 				        }
 				        else
 				        {
-					        timestamp absolute_expiry_time;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            timestamp absolute_expiry_time;
 					            if (amqpvalue_get_timestamp(item_value, &absolute_expiry_time) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            properties_destroy(*properties_handle);
 						            result = __FAILURE__;
 						            break;
@@ -14969,15 +15100,16 @@
 				        }
 				        else
 				        {
-					        timestamp creation_time;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            timestamp creation_time;
 					            if (amqpvalue_get_timestamp(item_value, &creation_time) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            properties_destroy(*properties_handle);
 						            result = __FAILURE__;
 						            break;
@@ -14997,15 +15129,16 @@
 				        }
 				        else
 				        {
-					        const char* group_id;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* group_id;
 					            if (amqpvalue_get_string(item_value, &group_id) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            properties_destroy(*properties_handle);
 						            result = __FAILURE__;
 						            break;
@@ -15025,15 +15158,16 @@
 				        }
 				        else
 				        {
-					        sequence_no group_sequence;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            sequence_no group_sequence;
 					            if (amqpvalue_get_sequence_no(item_value, &group_sequence) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            properties_destroy(*properties_handle);
 						            result = __FAILURE__;
 						            break;
@@ -15053,15 +15187,16 @@
 				        }
 				        else
 				        {
-					        const char* reply_to_group_id;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            const char* reply_to_group_id;
 					            if (amqpvalue_get_string(item_value, &reply_to_group_id) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            properties_destroy(*properties_handle);
 						            result = __FAILURE__;
 						            break;
@@ -16317,17 +16452,19 @@
 				        }
 				        else
 				        {
-					        uint32_t section_number;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        received_destroy(*received_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            uint32_t section_number;
 					            if (amqpvalue_get_uint(item_value, &section_number) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            received_destroy(*received_handle);
 						            result = __FAILURE__;
 						            break;
@@ -16355,17 +16492,19 @@
 				        }
 				        else
 				        {
-					        uint64_t section_offset;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        amqpvalue_destroy(item_value);
 						        received_destroy(*received_handle);
 						        result = __FAILURE__;
 						        break;
                             }
                             else
                             {
+					            uint64_t section_offset;
 					            if (amqpvalue_get_ulong(item_value, &section_offset) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            received_destroy(*received_handle);
 						            result = __FAILURE__;
 						            break;
@@ -16828,19 +16967,24 @@
 				        }
 				        else
 				        {
-					        ERROR_HANDLE error;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            ERROR_HANDLE error;
 					            if (amqpvalue_get_error(item_value, &error) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            rejected_destroy(*rejected_handle);
 						            result = __FAILURE__;
 						            break;
 					            }
+                                else
+                                {
+						            error_destroy(error);
+                                }
                             }
 
 					        amqpvalue_destroy(item_value);
@@ -17213,15 +17357,16 @@
 				        }
 				        else
 				        {
-					        bool delivery_failed;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool delivery_failed;
 					            if (amqpvalue_get_boolean(item_value, &delivery_failed) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            modified_destroy(*modified_handle);
 						            result = __FAILURE__;
 						            break;
@@ -17241,15 +17386,16 @@
 				        }
 				        else
 				        {
-					        bool undeliverable_here;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            bool undeliverable_here;
 					            if (amqpvalue_get_boolean(item_value, &undeliverable_here) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            modified_destroy(*modified_handle);
 						            result = __FAILURE__;
 						            break;
@@ -17269,15 +17415,16 @@
 				        }
 				        else
 				        {
-					        fields message_annotations;
-						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
-						    {
-						        /* no error, field is not mandatory */
-                            }
-                            else
-                            {
+						    if (amqpvalue_get_type(item_value) == AMQP_TYPE_NULL)
+						    {
+						        /* no error, field is not mandatory */
+                            }
+                            else
+                            {
+					            fields message_annotations;
 					            if (amqpvalue_get_fields(item_value, &message_annotations) != 0)
 					            {
+						            amqpvalue_destroy(item_value);
 						            modified_destroy(*modified_handle);
 						            result = __FAILURE__;
 						            break;