Skip to content

Commit 40c6f80

Browse files
author
Marc Stern
committed
Avoid some useless code and memory allocation in case no macro is present
1 parent e9bf697 commit 40c6f80

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

apache2/re_actions.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ int expand_macros(modsec_rec *msr, msc_string *var, msre_rule *rule, apr_pool_t
273273
next_text_start = p + 1;
274274
}
275275
} else {
276+
if (arr->nelts == 0) return 0; /* no macro */
276277
/* Text part. */
277278
part = (msc_string *)apr_pcalloc(mptmp, sizeof(msc_string));
278279
part->value = apr_pstrdup(mptmp, text_start);

0 commit comments

Comments
 (0)