Fix some memleak in API test.
---
src/ckpt/apitest/test_cpa.c | 2 ++
src/ckpt/apitest/test_cpa_util.c | 13 ++++++++++---
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/ckpt/apitest/test_cpa.c b/src/ckpt/apitest/test_cpa.c
index 6c37e91d5..0093b91ea 100644
--- a/src/ckpt/apitest/test_cpa.c
+++ b/src/ckpt/apitest/test_cpa.c
@@ -364,6 +364,7 @@ void fill_testcase_data()
*(ckpt_name + length) = '.';
saAisNameLend(ckpt_name,
&tcd.all_replicas_ckpt_with_valid_extended_name_length);
+ free(ckpt_name);
ckpt_name = malloc(INVALID_EXTENDED_NAME_LENGTH);
memset(ckpt_name, 0, INVALID_EXTENDED_NAME_LENGTH);
@@ -374,6 +375,7 @@ void fill_testcase_data()
*(ckpt_name + length) = '.';
saAisNameLend(ckpt_name,
&tcd.all_replicas_ckpt_with_invalid_extended_name_length);
+ free(ckpt_name);
/* Variables for sec create */
tcd.sec_id1 = (SaUint8T *)"11";
diff --git a/src/ckpt/apitest/test_cpa_util.c b/src/ckpt/apitest/test_cpa_util.c
index 474e76f0d..7da36e0c1 100644
--- a/src/ckpt/apitest/test_cpa_util.c
+++ b/src/ckpt/apitest/test_cpa_util.c
@@ -24,6 +24,7 @@ extern const char *saf_error_string[];
int gl_try_again_cnt;
int gl_tmout_cnt;
int gl_sync_pointnum;
+NCSCONTEXT gl_task_hdl = NULL;
int tmoutFlag;
int cpsv_test_result(SaAisErrorT rc, SaAisErrorT exp_out, char *test_case,
@@ -651,23 +652,24 @@ void selection_thread_blocking(NCSCONTEXT arg)
m_TEST_CPSV_PRINTF("\n Dispatching FAILED %d \n", rc);
else
m_TEST_CPSV_PRINTF("\n Thread selected \n");
+ m_NCS_TASK_RELEASE(gl_task_hdl);
}
void cpsv_createthread(SaCkptHandleT *cl_hdl)
{
SaAisErrorT rc;
- NCSCONTEXT thread_handle;
rc = m_NCS_TASK_CREATE((NCS_OS_CB)selection_thread_blocking,
(NCSCONTEXT)cl_hdl, "cpsv_block_test", 0,
- SCHED_OTHER, 8000, &thread_handle);
+ SCHED_OTHER, 8000, &gl_task_hdl);
if (rc != NCSCC_RC_SUCCESS) {
m_TEST_CPSV_PRINTF(" Failed to create thread\n");
return;
}
- rc = m_NCS_TASK_START(thread_handle);
+ rc = m_NCS_TASK_START(gl_task_hdl);
if (rc != NCSCC_RC_SUCCESS) {
+ m_NCS_TASK_RELEASE(gl_task_hdl);
m_TEST_CPSV_PRINTF(" Failed to start thread\n");
return;
}
@@ -3007,6 +3009,11 @@ static void ntfCallback(SaNtfSubscriptionIdT
subscriptionId,
break;
}
} while (false);
+
+ if (notification->notificationType == SA_NTF_TYPE_STATE_CHANGE)
+ saNtfNotificationFree(
+ notification->notification.stateChangeNotification
+ .notificationHandle);
}
int test_ckptNtfStateChange(int i, CONFIG_FLAG cfg_flg)
--
2.25.1
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel