This fixes assert-crash in doveadm mailbox list.
unsigned int count, lowest_count = UINT_MAX;
bool ret = FALSE;
+ if (*argsp == NULL)
+ return FALSE;
+
child_subargs_type = and_arg ? SEARCH_OR : SEARCH_SUB;
/* find the arg which has the lowest number of child args */
struct mail_search_arg *new_arg, *child_arg, *common_args = NULL;
enum mail_search_arg_type child_subargs_type;
- if ((*argsp)->next == NULL) {
+ if (*argsp == NULL || (*argsp)->next == NULL) {
/* single arg, nothing to extract */
return FALSE;
}
test_end();
}
+static void test_mail_search_args_simplify_empty_lists(void)
+{
+ struct mail_search_args *args;
+
+ test_begin("mail search args simplify empty args");
+
+ args = mail_search_build_init();
+ mail_search_args_simplify(args);
+ mail_search_args_unref(&args);
+
+ test_end();
+}
+
int main(void)
{
static void (*test_functions[])(void) = {
test_mail_search_args_simplify,
+ test_mail_search_args_simplify_empty_lists,
NULL
};