From 2118a94b8a77f29f761284f4d5c071d207973aa4 Mon Sep 17 00:00:00 2001 From: Deepthi C Shetty <115452109+dshett549@users.noreply.github.com> Date: Tue, 26 Mar 2024 23:14:20 +0530 Subject: [PATCH] RDKB-54362: Fix Memory Leak in gtest (#200) Reason for change: Fix Memory leak in rbus code. Test Procedure: Test and verified. Risks: Medium Priority: P1 Signed-off-by: Deepthi C Shetty --- unittests/rbus_unit_test_server.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/unittests/rbus_unit_test_server.cpp b/unittests/rbus_unit_test_server.cpp index baeaad10..bf2fb776 100644 --- a/unittests/rbus_unit_test_server.cpp +++ b/unittests/rbus_unit_test_server.cpp @@ -1132,17 +1132,19 @@ TEST_F(TestServer, rtmsg_rtConnection_CreateWithConfig_test3) TEST_F(TestServer, rtmsg_rtConnection_SendResponse_test1) { - char *name = "sample_test"; - rtMessageHeader const* hdr = (const rtMessageHeader*)name; + rtMessageHeader hdr; char* buff = "TestName"; rtError err; rtMessage res; rtConnection con; rtConnection_Create(&con, "PROVIDER1", "unix:///tmp/rtrouted"); + #ifdef MSG_ROUNDTRIP_TIME + rtMessageHeader_Init(&hdr); + #endif rtMessage_Create(&res); rtMessage_SetString(res, "reply", buff); - err = rtConnection_SendResponse(con, hdr, res, 1000); + err = rtConnection_SendResponse(con, &hdr, res, 1000); EXPECT_EQ(err, RT_OK); rtMessage_Release(res); rtConnection_Destroy(con);