mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-04 20:18:54 +00:00
pceplib: Fix some new coverity issues that trickled in
Several new issues came in because the coverity build system was not building the test infrastrucuture for the pceplib. Now we do, so we fixed it. Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
parent
aa474cf7b0
commit
bae20ff33b
@ -398,10 +398,8 @@ void test_pcep_msg_create_update()
|
||||
/* Should return NULL if obj_list is empty */
|
||||
message = pcep_msg_create_update(obj_list);
|
||||
CU_ASSERT_PTR_NULL(message);
|
||||
if (message != NULL) {
|
||||
if (message != NULL)
|
||||
pcep_msg_free_message(message);
|
||||
message = NULL;
|
||||
}
|
||||
|
||||
struct pcep_object_srp *srp = pcep_obj_create_srp(false, 100, NULL);
|
||||
struct pcep_object_lsp *lsp =
|
||||
@ -417,10 +415,9 @@ void test_pcep_msg_create_update()
|
||||
CU_ASSERT_PTR_NULL(message);
|
||||
|
||||
dll_append(obj_list, ero);
|
||||
if (message != NULL) {
|
||||
if (message != NULL)
|
||||
pcep_msg_free_message(message);
|
||||
message = NULL;
|
||||
}
|
||||
|
||||
message = pcep_msg_create_update(obj_list);
|
||||
CU_ASSERT_PTR_NOT_NULL(message);
|
||||
pcep_encode_message(message, versioning);
|
||||
@ -450,10 +447,8 @@ void test_pcep_msg_create_initiate()
|
||||
/* Should return NULL if obj_list is empty */
|
||||
struct pcep_message *message = pcep_msg_create_initiate(NULL);
|
||||
CU_ASSERT_PTR_NULL(message);
|
||||
if (message != NULL) {
|
||||
if (message != NULL)
|
||||
pcep_msg_free_message(message);
|
||||
message = NULL;
|
||||
}
|
||||
|
||||
struct pcep_object_srp *srp = pcep_obj_create_srp(false, 100, NULL);
|
||||
struct pcep_object_lsp *lsp =
|
||||
@ -466,10 +461,8 @@ void test_pcep_msg_create_initiate()
|
||||
dll_append(obj_list, srp);
|
||||
message = pcep_msg_create_initiate(obj_list);
|
||||
CU_ASSERT_PTR_NULL(message);
|
||||
if (message != NULL) {
|
||||
if (message != NULL)
|
||||
pcep_msg_free_message(message);
|
||||
message = NULL;
|
||||
}
|
||||
|
||||
dll_append(obj_list, lsp);
|
||||
dll_append(obj_list, ero);
|
||||
|
@ -105,10 +105,8 @@ void test_pcep_tlv_create_speaker_entity_id()
|
||||
double_linked_list *list = dll_initialize();
|
||||
tlv = pcep_tlv_create_speaker_entity_id(list);
|
||||
CU_ASSERT_PTR_NULL(tlv);
|
||||
if (tlv != NULL) {
|
||||
if (tlv != NULL)
|
||||
pceplib_free(PCEPLIB_INFRA, tlv);
|
||||
tlv = NULL;
|
||||
}
|
||||
|
||||
uint32_t *speaker_entity =
|
||||
pceplib_malloc(PCEPLIB_MESSAGES, sizeof(uint32_t));
|
||||
@ -179,28 +177,22 @@ void test_pcep_tlv_create_path_setup_type_capability()
|
||||
double_linked_list *pst_list = dll_initialize();
|
||||
tlv = pcep_tlv_create_path_setup_type_capability(pst_list, NULL);
|
||||
CU_ASSERT_PTR_NULL(tlv);
|
||||
if (tlv != NULL) {
|
||||
if (tlv != NULL)
|
||||
pcep_obj_free_tlv(&tlv->header);
|
||||
tlv = NULL;
|
||||
}
|
||||
|
||||
/* Should still return NULL if pst_list is NULL */
|
||||
double_linked_list *sub_tlv_list = dll_initialize();
|
||||
tlv = pcep_tlv_create_path_setup_type_capability(NULL, sub_tlv_list);
|
||||
CU_ASSERT_PTR_NULL(tlv);
|
||||
if (tlv != NULL) {
|
||||
if (tlv != NULL)
|
||||
pcep_obj_free_tlv(&tlv->header);
|
||||
tlv = NULL;
|
||||
}
|
||||
|
||||
/* Should still return NULL if pst_list is empty */
|
||||
tlv = pcep_tlv_create_path_setup_type_capability(pst_list,
|
||||
sub_tlv_list);
|
||||
CU_ASSERT_PTR_NULL(tlv);
|
||||
if (tlv != NULL) {
|
||||
if (tlv != NULL)
|
||||
pcep_obj_free_tlv(&tlv->header);
|
||||
tlv = NULL;
|
||||
}
|
||||
|
||||
/* Test only populating the pst list */
|
||||
uint8_t *pst1 = pceplib_malloc(PCEPLIB_MESSAGES, 1);
|
||||
|
Loading…
Reference in New Issue
Block a user