From b6df379cb9be57f729cf587761092258b5ee7257 Mon Sep 17 00:00:00 2001 From: Pradyumn-NEC Date: Tue, 6 Feb 2024 10:08:58 +0000 Subject: [PATCH 1/5] Fix for 4261 --- src/lib/jsonParseV2/parseNotification.cpp | 2 ++ .../0000_statistics_operation/statistics_with_counters.test | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/jsonParseV2/parseNotification.cpp b/src/lib/jsonParseV2/parseNotification.cpp index dd975f2e2f..fa2e441c0b 100644 --- a/src/lib/jsonParseV2/parseNotification.cpp +++ b/src/lib/jsonParseV2/parseNotification.cpp @@ -116,6 +116,8 @@ static bool parseNotificationData if (parseContextElementResponse(ciP, iter2, cerP, oeP) == false) { + //delete the allocated memory and return false + delete cerP; return false; } } diff --git a/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test b/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test index 26f899f85f..0d345c6ef7 100644 --- a/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test +++ b/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test @@ -145,7 +145,7 @@ payload='{ }' # FIXME #4261. Once the issue gets solved, this line should be uncommented # The REGEXPECT part would need a little adapation after that -#orionCurl --url /v2/op/notify -X POST --payload "$payload" > /dev/null +orionCurl --url /v2/op/notify -X POST --payload "$payload" > /dev/null payload='{ From 1be685a5ce2ad1f009747c708daa53cd7efb141d Mon Sep 17 00:00:00 2001 From: Pradyumn-NEC Date: Thu, 8 Feb 2024 12:37:16 +0000 Subject: [PATCH 2/5] Updated CHANGES_NEXT_RELEASE & statistics_with_counters.test --- CHANGES_NEXT_RELEASE | 1 + .../0000_statistics_operation/statistics_with_counters.test | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index e69de29bb2..96d575fabf 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -0,0 +1 @@ +- Fix: memory leak in POST /v2/op/notify operation (#4261) diff --git a/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test b/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test index 0d345c6ef7..0dcfbcb003 100644 --- a/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test +++ b/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test @@ -143,8 +143,6 @@ payload='{ } ] }' -# FIXME #4261. Once the issue gets solved, this line should be uncommented -# The REGEXPECT part would need a little adapation after that orionCurl --url /v2/op/notify -X POST --payload "$payload" > /dev/null @@ -325,6 +323,9 @@ Content-Length: REGEX(\d+) "OPTIONS": 1, "POST": 1 }, + "/v2/op/notify": { + "POST": 1 + }, "/v2/registrations": { "GET": 1, "OPTIONS": 1, From 9f10aaaa02cf9236f12083a75f65d84c7daa0bae Mon Sep 17 00:00:00 2001 From: Pradyumn-NEC Date: Fri, 9 Feb 2024 07:46:24 +0000 Subject: [PATCH 3/5] Updated statistics_with_counters.test --- .../0000_statistics_operation/statistics_with_counters.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test b/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test index 0dcfbcb003..cec3d2a2a6 100644 --- a/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test +++ b/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test @@ -261,7 +261,7 @@ Content-Length: REGEX(\d+) "deprecatedFeatures": { "ngsiv1Requests": 7 }, - "jsonRequests": 16, + "jsonRequests": 17, "noPayloadRequests": 42, "requests": { "/admin/log": { From 9d4b2cd1f42dfbc931ea62ace4b294373fe94cf6 Mon Sep 17 00:00:00 2001 From: Pradyumn Agrawal <142205397+Pradyumn-NEC@users.noreply.github.com> Date: Fri, 9 Feb 2024 18:17:22 +0530 Subject: [PATCH 4/5] Update statistics_with_counters.test Added OPTIONS in /v2/op/notify --- .../0000_statistics_operation/statistics_with_counters.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test b/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test index cec3d2a2a6..0632c4f1a2 100644 --- a/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test +++ b/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test @@ -143,6 +143,7 @@ payload='{ } ] }' +orionCurl --url /v2/op/notify -X OPTIONS > /dev/null orionCurl --url /v2/op/notify -X POST --payload "$payload" > /dev/null @@ -324,6 +325,7 @@ Content-Length: REGEX(\d+) "POST": 1 }, "/v2/op/notify": { + "OPTIONS": 1, "POST": 1 }, "/v2/registrations": { From 591f1df35823e3b758ce5bc0193bb9f5ad72049c Mon Sep 17 00:00:00 2001 From: Pradyumn Agrawal <142205397+PradyumnAgrawal05@users.noreply.github.com> Date: Fri, 16 Feb 2024 15:28:21 +0530 Subject: [PATCH 5/5] Updated statistics_with_counters.test Reordered the keys in the JSON. --- .../statistics_with_counters.test | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test b/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test index 0632c4f1a2..7205170f25 100644 --- a/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test +++ b/test/functionalTest/cases/0000_statistics_operation/statistics_with_counters.test @@ -143,7 +143,6 @@ payload='{ } ] }' -orionCurl --url /v2/op/notify -X OPTIONS > /dev/null orionCurl --url /v2/op/notify -X POST --payload "$payload" > /dev/null @@ -316,15 +315,14 @@ Content-Length: REGEX(\d+) "POST": 1, "PUT": 1 }, - "/v2/op/query": { - "OPTIONS": 1, + "/v2/op/notify": { "POST": 1 }, - "/v2/op/update": { + "/v2/op/query": { "OPTIONS": 1, "POST": 1 }, - "/v2/op/notify": { + "/v2/op/update": { "OPTIONS": 1, "POST": 1 },