diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 68d1efb13a..d37a866524 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1,4 +1,6 @@ +- Fix: memory leak in POST /v2/op/notify operation (#4261) - Fix: service path levels with 0 length should not be allowed (#4495) - Fix: changed the default value of `-dbTimeout` to 0 to resolve conflict with `-dbURI` (#4496) - Fix: wrong INFO startup log showing ORION_MONGO_TIMEOUT, ORION_IN_REQ_PAYLOAD_MAX_SIZE and ORION_OUT_REQ_MSG_MAX_SIZE env var values (#4496) - Fix: return 400 Bad Request when subject.entities exists but it is an empty array (#4499) + 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..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,9 +143,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='{ @@ -263,7 +261,7 @@ Content-Length: REGEX(\d+) "deprecatedFeatures": { "ngsiv1Requests": 7 }, - "jsonRequests": 16, + "jsonRequests": 17, "noPayloadRequests": 42, "requests": { "/admin/log": { @@ -317,6 +315,9 @@ Content-Length: REGEX(\d+) "POST": 1, "PUT": 1 }, + "/v2/op/notify": { + "POST": 1 + }, "/v2/op/query": { "OPTIONS": 1, "POST": 1 @@ -324,7 +325,7 @@ Content-Length: REGEX(\d+) "/v2/op/update": { "OPTIONS": 1, "POST": 1 - }, + }, "/v2/registrations": { "GET": 1, "OPTIONS": 1,