Skip to content
Snippets Groups Projects
Commit ea41a541 authored by Tristan Matthews's avatar Tristan Matthews
Browse files

* #8969: fixed memory leaks in sdes_negotiator

parent 76547698
No related branches found
No related tags found
No related merge requests found
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "pattern.h" #include "pattern.h"
#include <cstdio> #include <cstdio>
#include <memory>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <algorithm> #include <algorithm>
...@@ -60,30 +61,27 @@ std::vector<CryptoAttribute *> SdesNegotiator::parse() ...@@ -60,30 +61,27 @@ std::vector<CryptoAttribute *> SdesNegotiator::parse()
// syntax : // syntax :
//a=crypto:tag 1*WSP crypto-suite 1*WSP key-params *(1*WSP session-param) //a=crypto:tag 1*WSP crypto-suite 1*WSP key-params *(1*WSP session-param)
Pattern std::auto_ptr<Pattern> generalSyntaxPattern, tagPattern, cryptoSuitePattern,
* generalSyntaxPattern, keyParamsPattern;
* tagPattern,
* cryptoSuitePattern,
* keyParamsPattern;
try { try {
// used to match white space (which are used as separator) // used to match white space (which are used as separator)
generalSyntaxPattern = new Pattern("[\x20\x09]+", "g"); generalSyntaxPattern.reset(new Pattern("[\x20\x09]+", "g"));
tagPattern = new Pattern("^a=crypto:(?P<tag>[0-9]{1,9})"); tagPattern.reset(new Pattern("^a=crypto:(?P<tag>[0-9]{1,9})"));
cryptoSuitePattern = new Pattern( cryptoSuitePattern.reset(new Pattern(
"(?P<cryptoSuite>AES_CM_128_HMAC_SHA1_80|" \ "(?P<cryptoSuite>AES_CM_128_HMAC_SHA1_80|" \
"AES_CM_128_HMAC_SHA1_32|" \ "AES_CM_128_HMAC_SHA1_32|" \
"F8_128_HMAC_SHA1_80|" \ "F8_128_HMAC_SHA1_80|" \
"[A-Za-z0-9_]+)"); // srtp-crypto-suite-ext "[A-Za-z0-9_]+)")); // srtp-crypto-suite-ext
keyParamsPattern = new Pattern( keyParamsPattern.reset(new Pattern(
"(?P<srtpKeyMethod>inline|[A-Za-z0-9_]+)\\:" \ "(?P<srtpKeyMethod>inline|[A-Za-z0-9_]+)\\:" \
"(?P<srtpKeyInfo>[A-Za-z0-9\x2B\x2F\x3D]+)" \ "(?P<srtpKeyInfo>[A-Za-z0-9\x2B\x2F\x3D]+)" \
"(\\|2\\^(?P<lifetime>[0-9]+)\\|" \ "(\\|2\\^(?P<lifetime>[0-9]+)\\|" \
"(?P<mkiValue>[0-9]+)\\:" \ "(?P<mkiValue>[0-9]+)\\:" \
"(?P<mkiLength>[0-9]{1,3})\\;?)?", "g"); "(?P<mkiLength>[0-9]{1,3})\\;?)?", "g"));
} catch (const CompileError& exception) { } catch (const CompileError& exception) {
throw ParseError("A compile exception occured on a pattern."); throw ParseError("A compile exception occured on a pattern.");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment