mirror of https://github.com/Icinga/icinga2.git
Fix memory leaks in the config parser.
This commit is contained in:
parent
8ac0a80101
commit
ca4157ea24
|
@ -104,6 +104,8 @@ void AttributeHolder::Bind(AttributeBase *boundAttribute)
|
||||||
{
|
{
|
||||||
ASSERT(m_OwnsAttribute);
|
ASSERT(m_OwnsAttribute);
|
||||||
boundAttribute->Set(m_Attribute->Get());
|
boundAttribute->Set(m_Attribute->Get());
|
||||||
|
if (m_OwnsAttribute)
|
||||||
|
delete m_Attribute;
|
||||||
m_Attribute = boundAttribute;
|
m_Attribute = boundAttribute;
|
||||||
m_OwnsAttribute = false;
|
m_OwnsAttribute = false;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -69,6 +69,7 @@
|
||||||
#include <stack>
|
#include <stack>
|
||||||
#include <boost/smart_ptr/make_shared.hpp>
|
#include <boost/smart_ptr/make_shared.hpp>
|
||||||
#include <boost/exception/diagnostic_information.hpp>
|
#include <boost/exception/diagnostic_information.hpp>
|
||||||
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
using namespace icinga;
|
using namespace icinga;
|
||||||
|
|
||||||
|
@ -78,7 +79,7 @@ using namespace icinga;
|
||||||
|
|
||||||
|
|
||||||
/* Line 2068 of yacc.c */
|
/* Line 2068 of yacc.c */
|
||||||
#line 82 "config_parser.h"
|
#line 83 "config_parser.h"
|
||||||
|
|
||||||
/* Tokens. */
|
/* Tokens. */
|
||||||
#ifndef YYTOKENTYPE
|
#ifndef YYTOKENTYPE
|
||||||
|
@ -154,18 +155,22 @@ typedef union YYSTYPE
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Line 2068 of yacc.c */
|
/* Line 2068 of yacc.c */
|
||||||
#line 52 "config_parser.yy"
|
#line 53 "config_parser.yy"
|
||||||
|
|
||||||
char *text;
|
char *text;
|
||||||
double num;
|
double num;
|
||||||
icinga::Value *variant;
|
icinga::Value *variant;
|
||||||
icinga::ExpressionOperator op;
|
icinga::ExpressionOperator op;
|
||||||
icinga::TypeSpecifier type;
|
icinga::TypeSpecifier type;
|
||||||
|
std::vector<String> *slist;
|
||||||
|
Expression *expr;
|
||||||
|
ExpressionList *exprl;
|
||||||
|
Array *array;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Line 2068 of yacc.c */
|
/* Line 2068 of yacc.c */
|
||||||
#line 169 "config_parser.h"
|
#line 174 "config_parser.h"
|
||||||
} YYSTYPE;
|
} YYSTYPE;
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||||
|
|
|
@ -345,6 +345,7 @@ object_inherits_list:
|
||||||
{
|
{
|
||||||
$$ = new std::vector<String>();
|
$$ = new std::vector<String>();
|
||||||
$$->push_back($1);
|
$$->push_back($1);
|
||||||
|
free($1);
|
||||||
}
|
}
|
||||||
| object_inherits_list ',' T_STRING
|
| object_inherits_list ',' T_STRING
|
||||||
{
|
{
|
||||||
|
@ -354,6 +355,7 @@ object_inherits_list:
|
||||||
$$ = new std::vector<String>();
|
$$ = new std::vector<String>();
|
||||||
|
|
||||||
$$->push_back($3);
|
$$->push_back($3);
|
||||||
|
free($3);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -390,6 +392,7 @@ expressions_inner: /* empty */
|
||||||
{
|
{
|
||||||
$$ = new ExpressionList();
|
$$ = new ExpressionList();
|
||||||
$$->AddExpression(*$1);
|
$$->AddExpression(*$1);
|
||||||
|
delete $1;
|
||||||
}
|
}
|
||||||
| expressions_inner ',' expression
|
| expressions_inner ',' expression
|
||||||
{
|
{
|
||||||
|
@ -399,6 +402,7 @@ expressions_inner: /* empty */
|
||||||
$$ = new ExpressionList();
|
$$ = new ExpressionList();
|
||||||
|
|
||||||
$$->AddExpression(*$3);
|
$$->AddExpression(*$3);
|
||||||
|
delete $3;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -455,6 +459,7 @@ array_items_inner: /* empty */
|
||||||
{
|
{
|
||||||
$$ = new Array();
|
$$ = new Array();
|
||||||
$$->Add(*$1);
|
$$->Add(*$1);
|
||||||
|
delete $1;
|
||||||
}
|
}
|
||||||
| array_items_inner ',' value
|
| array_items_inner ',' value
|
||||||
{
|
{
|
||||||
|
@ -464,6 +469,7 @@ array_items_inner: /* empty */
|
||||||
$$ = new Array();
|
$$ = new Array();
|
||||||
|
|
||||||
$$->Add(*$3);
|
$$->Add(*$3);
|
||||||
|
delete $3;
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue