File tree Expand file tree Collapse file tree 4 files changed +31
-7
lines changed
Expand file tree Collapse file tree 4 files changed +31
-7
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,17 @@ GeoFilter::GeoFilter()
5353
5454
5555
56+ /* ****************************************************************************
57+ *
58+ * GeoFilter::~GeoFilter -
59+ */
60+ GeoFilter::~GeoFilter ()
61+ {
62+ release ();
63+ }
64+
65+
66+
5667/* ****************************************************************************
5768*
5869* pointVectorRelease -
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ typedef struct GeoFilter
4747 orion::Georel georel;
4848
4949 GeoFilter ();
50+ ~GeoFilter ();
5051
5152 int fill (const std::string& geometry,
5253 const std::string& coords,
Original file line number Diff line number Diff line change @@ -65,19 +65,20 @@ static void insertInCache
6565 double now
6666)
6767{
68- // set strinFilterP and mdStringFilterP (they will be used later in subCacheItemInsert)
68+ // set stringFilterP and mdStringFilterP (they will be used later in subCacheItemInsert)
6969 std::string err;
7070
7171 StringFilter* stringFilterP = sub.subject .condition .expression .stringFilter .clone (&err);
7272 if (stringFilterP == NULL )
7373 {
74- LM_E ((" Runtime Error (cloning stringFilter: %s" , err.c_str ()));
74+ LM_E ((" Runtime Error (cloning stringFilter: %s) " , err.c_str ()));
7575 return ;
7676 }
7777 StringFilter* mdStringFilterP = sub.subject .condition .expression .mdStringFilter .clone (&err);
78- if (stringFilterP == NULL )
78+ if (mdStringFilterP == NULL )
7979 {
80- LM_E ((" Runtime Error (cloning mdStringFilterP: %s" , err.c_str ()));
80+ delete stringFilterP;
81+ LM_E ((" Runtime Error (cloning mdStringFilterP: %s)" , err.c_str ()));
8182 return ;
8283 }
8384
@@ -118,6 +119,11 @@ static void insertInCache
118119 sub.subject .condition .notifyOnMetadataChange );
119120
120121 cacheSemGive (__FUNCTION__, " Inserting subscription in cache" );
122+
123+ // Release dynamic memory allocated by clone() methods
124+ // (note stringFilterP and mdStringFilterP can be not NULL as that condition is already checked above)
125+ delete stringFilterP;
126+ delete mdStringFilterP;
121127}
122128
123129
Original file line number Diff line number Diff line change @@ -151,14 +151,15 @@ static void updateInCache
151151 StringFilter* stringFilterP = subUp.subject .condition .expression .stringFilter .clone (&err);
152152 if (stringFilterP == NULL )
153153 {
154- LM_E ((" Runtime Error (cloning stringFilter: %s" , err.c_str ()));
154+ LM_E ((" Runtime Error (cloning stringFilter: %s) " , err.c_str ()));
155155 return ;
156156 }
157157
158158 StringFilter* mdStringFilterP = subUp.subject .condition .expression .mdStringFilter .clone (&err);
159- if (stringFilterP == NULL )
159+ if (mdStringFilterP == NULL )
160160 {
161- LM_E ((" Runtime Error (cloning mdStringFilterP: %s" , err.c_str ()));
161+ delete stringFilterP;
162+ LM_E ((" Runtime Error (cloning mdStringFilterP: %s)" , err.c_str ()));
162163 return ;
163164 }
164165
@@ -306,6 +307,11 @@ static void updateInCache
306307 }
307308
308309 cacheSemGive (__FUNCTION__, " Updating cached subscription" );
310+
311+ // Release dynamic memory allocated by clone() methods
312+ // (note stringFilterP and mdStringFilterP can be not NULL as that condition is already checked above)
313+ delete stringFilterP;
314+ delete mdStringFilterP;
309315}
310316
311317
You can’t perform that action at this time.
0 commit comments