@@ -2611,10 +2611,10 @@ void TestReadInteraction::TestSubscribeWildcard()
2611
2611
ReadPrepareParams readPrepareParams (GetSessionBobToAlice ());
2612
2612
readPrepareParams.mEventPathParamsListSize = 0 ;
2613
2613
2614
- std::unique_ptr<chip::app::AttributePathParams[]> attributePathParams (new chip::app::AttributePathParams[2 ]);
2615
- // Subscribe to full wildcard paths, repeat twice to ensure chunking.
2616
- readPrepareParams.mpAttributePathParamsList = attributePathParams.get ();
2617
2614
readPrepareParams.mAttributePathParamsListSize = 2 ;
2615
+ auto attributePathParams = std::make_unique<chip::app::AttributePathParams[]>(readPrepareParams.mAttributePathParamsListSize );
2616
+ // Subscribe to full wildcard paths, repeat twice to ensure chunking.
2617
+ readPrepareParams.mpAttributePathParamsList = attributePathParams.get ();
2618
2618
2619
2619
readPrepareParams.mMinIntervalFloorSeconds = 0 ;
2620
2620
readPrepareParams.mMaxIntervalCeilingSeconds = 1 ;
@@ -2745,11 +2745,11 @@ void TestReadInteraction::TestSubscribePartialOverlap()
2745
2745
ReadPrepareParams readPrepareParams (GetSessionBobToAlice ());
2746
2746
readPrepareParams.mEventPathParamsListSize = 0 ;
2747
2747
2748
- std::unique_ptr<chip::app::AttributePathParams[]> attributePathParams (new chip::app::AttributePathParams[2 ]);
2749
- attributePathParams[0 ].mClusterId = chip::Test::MockClusterId (3 );
2750
- attributePathParams[0 ].mAttributeId = chip::Test::MockAttributeId (1 );
2751
- readPrepareParams.mpAttributePathParamsList = attributePathParams.get ();
2752
2748
readPrepareParams.mAttributePathParamsListSize = 1 ;
2749
+ auto attributePathParams = std::make_unique<chip::app::AttributePathParams[]>(readPrepareParams.mAttributePathParamsListSize );
2750
+ attributePathParams[0 ].mClusterId = chip::Test::MockClusterId (3 );
2751
+ attributePathParams[0 ].mAttributeId = chip::Test::MockAttributeId (1 );
2752
+ readPrepareParams.mpAttributePathParamsList = attributePathParams.get ();
2753
2753
2754
2754
readPrepareParams.mMinIntervalFloorSeconds = 0 ;
2755
2755
readPrepareParams.mMaxIntervalCeilingSeconds = 1 ;
@@ -2817,12 +2817,12 @@ void TestReadInteraction::TestSubscribeSetDirtyFullyOverlap()
2817
2817
ReadPrepareParams readPrepareParams (GetSessionBobToAlice ());
2818
2818
readPrepareParams.mEventPathParamsListSize = 0 ;
2819
2819
2820
- std::unique_ptr<chip::app::AttributePathParams[]> attributePathParams (new chip::app::AttributePathParams[1 ]);
2821
- attributePathParams[0 ].mClusterId = chip::Test::kMockEndpoint2 ;
2822
- attributePathParams[0 ].mClusterId = chip::Test::MockClusterId (3 );
2823
- attributePathParams[0 ].mAttributeId = chip::Test::MockAttributeId (1 );
2824
- readPrepareParams.mpAttributePathParamsList = attributePathParams.get ();
2825
2820
readPrepareParams.mAttributePathParamsListSize = 1 ;
2821
+ auto attributePathParams = std::make_unique<chip::app::AttributePathParams[]>(readPrepareParams.mAttributePathParamsListSize );
2822
+ attributePathParams[0 ].mEndpointId = chip::Test::kMockEndpoint2 ;
2823
+ attributePathParams[0 ].mClusterId = chip::Test::MockClusterId (3 );
2824
+ attributePathParams[0 ].mAttributeId = chip::Test::MockAttributeId (1 );
2825
+ readPrepareParams.mpAttributePathParamsList = attributePathParams.get ();
2826
2826
2827
2827
readPrepareParams.mMinIntervalFloorSeconds = 0 ;
2828
2828
readPrepareParams.mMaxIntervalCeilingSeconds = 1 ;
@@ -4799,12 +4799,13 @@ void TestReadInteraction::TestSubscribeInvalidateFabric()
4799
4799
EXPECT_EQ (engine->Init (&GetExchangeManager (), &GetFabricTable (), gReportScheduler ), CHIP_NO_ERROR);
4800
4800
4801
4801
ReadPrepareParams readPrepareParams (GetSessionBobToAlice ());
4802
- readPrepareParams.mpAttributePathParamsList = new chip::app::AttributePathParams[1 ];
4803
- readPrepareParams.mAttributePathParamsListSize = 1 ;
4804
4802
4805
- readPrepareParams.mpAttributePathParamsList [0 ].mEndpointId = chip::Test::kMockEndpoint3 ;
4806
- readPrepareParams.mpAttributePathParamsList [0 ].mClusterId = chip::Test::MockClusterId (2 );
4807
- readPrepareParams.mpAttributePathParamsList [0 ].mAttributeId = chip::Test::MockAttributeId (1 );
4803
+ readPrepareParams.mAttributePathParamsListSize = 1 ;
4804
+ auto attributePathParams = std::make_unique<chip::app::AttributePathParams[]>(readPrepareParams.mAttributePathParamsListSize );
4805
+ attributePathParams[0 ].mEndpointId = chip::Test::kMockEndpoint3 ;
4806
+ attributePathParams[0 ].mClusterId = chip::Test::MockClusterId (2 );
4807
+ attributePathParams[0 ].mAttributeId = chip::Test::MockAttributeId (1 );
4808
+ readPrepareParams.mpAttributePathParamsList = attributePathParams.get ();
4808
4809
4809
4810
readPrepareParams.mMinIntervalFloorSeconds = 0 ;
4810
4811
readPrepareParams.mMaxIntervalCeilingSeconds = 0 ;
@@ -4815,6 +4816,7 @@ void TestReadInteraction::TestSubscribeInvalidateFabric()
4815
4816
4816
4817
delegate.mGotReport = false ;
4817
4818
4819
+ attributePathParams.release ();
4818
4820
EXPECT_EQ (readClient.SendAutoResubscribeRequest (std::move (readPrepareParams)), CHIP_NO_ERROR);
4819
4821
4820
4822
DrainAndServiceIO ();
@@ -4856,12 +4858,13 @@ void TestReadInteraction::TestShutdownSubscription()
4856
4858
EXPECT_EQ (engine->Init (&GetExchangeManager (), &GetFabricTable (), gReportScheduler ), CHIP_NO_ERROR);
4857
4859
4858
4860
ReadPrepareParams readPrepareParams (GetSessionBobToAlice ());
4859
- readPrepareParams.mpAttributePathParamsList = new chip::app::AttributePathParams[1 ];
4860
- readPrepareParams.mAttributePathParamsListSize = 1 ;
4861
4861
4862
- readPrepareParams.mpAttributePathParamsList [0 ].mEndpointId = chip::Test::kMockEndpoint3 ;
4863
- readPrepareParams.mpAttributePathParamsList [0 ].mClusterId = chip::Test::MockClusterId (2 );
4864
- readPrepareParams.mpAttributePathParamsList [0 ].mAttributeId = chip::Test::MockAttributeId (1 );
4862
+ readPrepareParams.mAttributePathParamsListSize = 1 ;
4863
+ auto attributePathParams = std::make_unique<chip::app::AttributePathParams[]>(readPrepareParams.mAttributePathParamsListSize );
4864
+ attributePathParams[0 ].mEndpointId = chip::Test::kMockEndpoint3 ;
4865
+ attributePathParams[0 ].mClusterId = chip::Test::MockClusterId (2 );
4866
+ attributePathParams[0 ].mAttributeId = chip::Test::MockAttributeId (1 );
4867
+ readPrepareParams.mpAttributePathParamsList = attributePathParams.get ();
4865
4868
4866
4869
readPrepareParams.mMinIntervalFloorSeconds = 0 ;
4867
4870
readPrepareParams.mMaxIntervalCeilingSeconds = 0 ;
@@ -4872,6 +4875,7 @@ void TestReadInteraction::TestShutdownSubscription()
4872
4875
4873
4876
delegate.mGotReport = false ;
4874
4877
4878
+ attributePathParams.release ();
4875
4879
EXPECT_EQ (readClient.SendAutoResubscribeRequest (std::move (readPrepareParams)), CHIP_NO_ERROR);
4876
4880
4877
4881
DrainAndServiceIO ();
0 commit comments