From f51e9e6129a4364196f40b68d6388055e20852b1 Mon Sep 17 00:00:00 2001 From: Thomas Porzelt Date: Mon, 28 Sep 2009 23:06:26 +0200 Subject: [PATCH] [core] Fix segfault when regex condition errors --- src/main/actions.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/actions.c b/src/main/actions.c index 2f54b5f..bef1705 100644 --- a/src/main/actions.c +++ b/src/main/actions.c @@ -133,11 +133,13 @@ static void action_stack_element_release(liServer *srv, liVRequest *vr, action_s if (a->data.condition.cond->rvalue.type == LI_COND_VALUE_REGEXP) { /* pop regex stack */ GArray *rs = vr->action_stack.regex_stack; - liActionRegexStackElement *arse = &g_array_index(rs, liActionRegexStackElement, rs->len - 1); - if (arse->string) - g_string_free(arse->string, TRUE); - g_match_info_free(arse->match_info); - g_array_set_size(rs, rs->len - 1); + if (rs->len) { + liActionRegexStackElement *arse = &g_array_index(rs, liActionRegexStackElement, rs->len - 1); + if (arse->string) + g_string_free(arse->string, TRUE); + g_match_info_free(arse->match_info); + g_array_set_size(rs, rs->len - 1); + } } break; case ACTION_TLIST: