diff --git a/tests/z_api_encoding_test.c b/tests/z_api_encoding_test.c index 03a3b0df9..98895a003 100644 --- a/tests/z_api_encoding_test.c +++ b/tests/z_api_encoding_test.c @@ -85,6 +85,7 @@ void test_with_schema(void) { z_encoding_to_string(z_encoding_loan_mut(&e), &s); assert(strncmp("zenoh/bytes;my_schema", z_string_data(z_string_loan(&s)), z_string_len(z_string_loan(&s))) == 0); z_encoding_drop(z_encoding_move(&e)); + z_string_drop(z_string_move(&s)); z_encoding_from_str(&e, "zenoh/string;"); z_encoding_set_schema_from_substr(z_encoding_loan_mut(&e), "my_schema", 3); diff --git a/tests/z_channels_test.c b/tests/z_channels_test.c index 5bd241d53..80ea7e9f4 100644 --- a/tests/z_channels_test.c +++ b/tests/z_channels_test.c @@ -13,12 +13,10 @@ // #include #include -#include -#include #include "zenoh-pico/api/handlers.h" #include "zenoh-pico/api/macros.h" -#include "zenoh-pico/net/sample.h" +#include "zenoh-pico/collections/bytes.h" #undef NDEBUG #include @@ -37,6 +35,7 @@ .attachment = _z_bytes_null(), \ }; \ z_call(*z_loan(closure), &sample); \ + _z_bytes_drop(&payload); \ } while (0); #define _RECV(handler, method, buf) \ @@ -192,11 +191,13 @@ void zero_size_test(void) { assert(z_fifo_channel_sample_new(&closure, &fifo_handler, 0) != Z_OK); assert(z_fifo_channel_sample_new(&closure, &fifo_handler, 1) == Z_OK); z_drop(z_move(fifo_handler)); + z_drop(z_move(closure)); z_owned_ring_handler_sample_t ring_handler; assert(z_ring_channel_sample_new(&closure, &ring_handler, 0) != Z_OK); assert(z_ring_channel_sample_new(&closure, &ring_handler, 1) == Z_OK); z_drop(z_move(ring_handler)); + z_drop(z_move(closure)); } int main(void) { diff --git a/tests/z_data_struct_test.c b/tests/z_data_struct_test.c index e3dff0fa5..045f832e8 100644 --- a/tests/z_data_struct_test.c +++ b/tests/z_data_struct_test.c @@ -15,6 +15,7 @@ #include #include #include +#include #include "zenoh-pico/api/primitives.h" #include "zenoh-pico/api/types.h" @@ -29,6 +30,7 @@ void entry_list_test(void) { _z_transport_peer_entry_list_t *root = _z_transport_peer_entry_list_new(); for (int i = 0; i < 10; i++) { _z_transport_peer_entry_t *entry = (_z_transport_peer_entry_t *)z_malloc(sizeof(_z_transport_peer_entry_t)); + memset(entry, 0, sizeof(_z_transport_peer_entry_t)); root = _z_transport_peer_entry_list_insert(root, entry); } _z_transport_peer_entry_list_t *list = root; @@ -39,6 +41,7 @@ void entry_list_test(void) { for (int i = 0; i < 11; i++) { _z_transport_peer_entry_t *entry = (_z_transport_peer_entry_t *)z_malloc(sizeof(_z_transport_peer_entry_t)); + memset(entry, 0, sizeof(_z_transport_peer_entry_t)); root = _z_transport_peer_entry_list_insert(root, entry); } assert(_z_transport_peer_entry_list_head(root)->_peer_id == _Z_KEYEXPR_MAPPING_UNKNOWN_REMOTE - 1); @@ -140,6 +143,8 @@ void str_vec_list_intmap_test(void) { _z_str_intmap_clear(&map); assert(_z_str_intmap_is_empty(&map) == true); + + z_free(s); } void _z_slice_custom_deleter(void *data, void *context) { @@ -243,6 +248,7 @@ void z_id_to_string_test(void) { assert(z_string_len(z_string_loan(&id_str)) == 32); assert(strncmp("0f0e0d0c0b0a09080706050403020100", z_string_data(z_string_loan(&id_str)), z_string_len(z_string_loan(&id_str))) == 0); + z_string_drop(z_string_move(&id_str)); } int main(void) {