Browse Source

konfd: Fix segmentation fault while del_pattern operation

Serj Kalichev 3 years ago
parent
commit
eeb753f099
1 changed files with 4 additions and 0 deletions
  1. 4 0
      konf/tree/tree.c

+ 4 - 0
konf/tree/tree.c

@@ -250,6 +250,10 @@ int konf_tree_del_pattern(konf_tree_t *this,
 	if (!(iter = lub_list__get_head(this->list)))
 		return 0;
 
+	/* Pattern is not specified */
+	if (!pattern)
+		return -1;
+
 	/* Compile regular expression */
 	if (regcomp(&regexp, pattern, REG_EXTENDED | REG_ICASE) != 0)
 		return -1;