summaryrefslogtreecommitdiffstats
path: root/src/simple_pattern.c
diff options
context:
space:
mode:
authorFederico Ceratto <federico.ceratto@gmail.com>2017-04-30 16:09:37 +0000
committerFederico Ceratto <federico.ceratto@gmail.com>2017-04-30 18:09:45 +0000
commitbed7e5b6a0b9ea0ddfc76c6f77eb91df81b92521 (patch)
tree519e5945ec0db75bfb50583539caa408a5819e87 /src/simple_pattern.c
parentTemporarily disable signature checking (diff)
downloadnetdata-bed7e5b6a0b9ea0ddfc76c6f77eb91df81b92521.tar.xz
netdata-bed7e5b6a0b9ea0ddfc76c6f77eb91df81b92521.zip
New upstream version 1.6.0+dfsg
Diffstat (limited to 'src/simple_pattern.c')
-rw-r--r--src/simple_pattern.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/simple_pattern.c b/src/simple_pattern.c
index 7e4424297..f72a42d06 100644
--- a/src/simple_pattern.c
+++ b/src/simple_pattern.c
@@ -169,7 +169,7 @@ static inline int match_pattern(struct simple_pattern *m, const char *str, size_
int simple_pattern_matches(SIMPLE_PATTERN *list, const char *str) {
struct simple_pattern *m, *root = (struct simple_pattern *)list;
- if(unlikely(!root)) return 0;
+ if(unlikely(!root || !str || !*str)) return 0;
size_t len = strlen(str);
for(m = root; m ; m = m->next)
@@ -184,8 +184,8 @@ int simple_pattern_matches(SIMPLE_PATTERN *list, const char *str) {
static inline void free_pattern(struct simple_pattern *m) {
if(!m) return;
- if(m->next) free_pattern(m->next);
- if(m->child) free_pattern(m->child);
+ free_pattern(m->child);
+ free_pattern(m->next);
freez((void *)m->match);
freez(m);
}
@@ -193,5 +193,5 @@ static inline void free_pattern(struct simple_pattern *m) {
void simple_pattern_free(SIMPLE_PATTERN *list) {
if(!list) return;
- free_pattern(((struct simple_pattern *)list)->next);
+ free_pattern(((struct simple_pattern *)list));
}