/* Parse flags */
p = end + 1;
re_flags = g_string_sized_new (32);
+
while (p != NULL) {
switch (*p) {
case 'i':
result->regexp = rspamd_regexp_new (dbegin, re_flags->str,
&err);
- if (result->is_multiple) {
- rspamd_regexp_set_maxhits (result->regexp, 0);
- }
- else {
- rspamd_regexp_set_maxhits (result->regexp, 1);
- }
-
g_string_free (re_flags, TRUE);
if (result->regexp == NULL || err != NULL) {
return NULL;
}
+ if (result->regexp) {
+ if (result->is_multiple) {
+ rspamd_regexp_set_maxhits (result->regexp, 0);
+ }
+ else {
+ rspamd_regexp_set_maxhits (result->regexp, 1);
+ }
+ }
+
rspamd_mempool_add_destructor (pool,
(rspamd_mempool_destruct_t) rspamd_regexp_unref,
(void *)result->regexp);