projects
/
apt.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
* apt-pkg/contrib/mmap.cc:
[apt.git]
/
apt-pkg
/
contrib
/
configuration.cc
diff --git
a/apt-pkg/contrib/configuration.cc
b/apt-pkg/contrib/configuration.cc
index 81cc87d15e93b434e1a0003c65bdcc96b6ec7866..cc7093fe2cf4146c1574dcd38f03fead67ed2dc6 100644
(file)
--- a/
apt-pkg/contrib/configuration.cc
+++ b/
apt-pkg/contrib/configuration.cc
@@
-857,19
+857,27
@@
Configuration::MatchAgainstConfig::MatchAgainstConfig(char const * Config)
{
regfree(p);
delete p;
{
regfree(p);
delete p;
+ clearPatterns();
_error->Warning("Regex compilation error for '%s' in configuration option '%s'",
s->c_str(), Config);
_error->Warning("Regex compilation error for '%s' in configuration option '%s'",
s->c_str(), Config);
+ return;
}
}
- }
-
+ }
+ if (strings.size() == 0)
+ patterns.push_back(NULL);
}
/*}}}*/
// MatchAgainstConfig Destructor /*{{{*/
Configuration::MatchAgainstConfig::~MatchAgainstConfig()
}
/*}}}*/
// MatchAgainstConfig Destructor /*{{{*/
Configuration::MatchAgainstConfig::~MatchAgainstConfig()
+{
+ clearPatterns();
+}
+void Configuration::MatchAgainstConfig::clearPatterns()
{
for(std::vector<regex_t *>::const_iterator p = patterns.begin();
p != patterns.end(); ++p)
{
{
for(std::vector<regex_t *>::const_iterator p = patterns.begin();
p != patterns.end(); ++p)
{
+ if (*p == NULL) continue;
regfree(*p);
delete *p;
}
regfree(*p);
delete *p;
}
@@
-880,7
+888,7
@@
bool Configuration::MatchAgainstConfig::Match(char const * str) const
{
for(std::vector<regex_t *>::const_iterator p = patterns.begin();
p != patterns.end(); ++p)
{
for(std::vector<regex_t *>::const_iterator p = patterns.begin();
p != patterns.end(); ++p)
- if (regexec(*p, str, 0, 0, 0) == 0)
+ if (
*p != NULL &&
regexec(*p, str, 0, 0, 0) == 0)
return true;
return false;
return true;
return false;