Skip to content

Commit

Permalink
interfaces-plugin: fix memory leak, check name null/non-null
Browse files Browse the repository at this point in the history
  • Loading branch information
andrej committed Dec 9, 2022
1 parent 85310bd commit 652bf85
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/interfaces/tests/interfaces_utest.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@ static void test_state_hash_set_name_correct(void **state)

rc = interfaces_interface_state_hash_element_set_name(&new_elem, "FOO");
assert_int_equal(rc, 0);
assert_non_null(new_elem->state.name);

interfaces_interface_state_hash_element_free(&new_elem);
}

static void test_state_hash_set_name_incorrect(void **state)
Expand All @@ -264,7 +267,10 @@ static void test_state_hash_set_name_incorrect(void **state)
new_elem = interfaces_interface_state_hash_element_new();

rc = interfaces_interface_state_hash_element_set_name(&new_elem, NULL);
assert_int_not_equal(rc, 0);
assert_int_equal(rc, 0);
assert_null(new_elem->state.name);

interfaces_interface_state_hash_element_free(&new_elem);
}

static void test_interface_list_new_correct(void **state)
Expand Down

0 comments on commit 652bf85

Please sign in to comment.