int mutt_pattern_func (int op, char *prompt)
{
- pattern_t *pat;
- char buf[LONG_STRING] = "", *simple;
+ pattern_t *pat = NULL;
+ char buf[LONG_STRING] = "", *simple = NULL;
BUFFER err;
- int i;
+ int i, rv = -1;
progress_t progress;
strfcpy (buf, NONULL (Context->pattern), sizeof (buf));
err.data = safe_malloc(err.dsize);
if ((pat = mutt_pattern_comp (buf, MUTT_FULL_MSG, &err)) == NULL)
{
- FREE (&simple);
mutt_error ("%s", err.data);
- FREE (&err.data);
- return (-1);
+ goto bail;
}
#ifdef USE_IMAP
if (Context->magic == MUTT_IMAP && imap_search (Context, pat) < 0)
- return -1;
+ goto bail;
#endif
mutt_progress_init (&progress, _("Executing command on matching messages..."),
Context->limit_pattern = mutt_pattern_comp (buf, MUTT_FULL_MSG, &err);
}
}
+
+ rv = 0;
+
+bail:
FREE (&simple);
mutt_pattern_free (&pat);
FREE (&err.data);
- return 0;
+ return rv;
}
int mutt_search_command (int cur, int op)
LastSearch[0] = '\0';
return (-1);
}
+ FREE (&err.data);
mutt_clear_error ();
}
}