summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 03576db)
raw | patch | inline | side by side (parent: 03576db)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 8 Nov 2008 08:46:29 +0000 (09:46 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Sat, 8 Nov 2008 08:46:29 +0000 (09:46 +0100) |
src/filter_pcre.c | patch | blob | history |
diff --git a/src/filter_pcre.c b/src/filter_pcre.c
index 7b223e7c87d8faa25f57510a42333186452d6c76..3b1afbf5fbf37f455fed258887114058f93194df 100644 (file)
--- a/src/filter_pcre.c
+++ b/src/filter_pcre.c
static regex_t *regex_new (void)
{
regex_t *re;
+ regex_t *temp;
- ++regexes_num;
- regexes = (regex_t *)realloc (regexes, regexes_num * sizeof (*regexes));
- if (NULL == regexes) {
+ temp = (regex_t *) realloc (regexes, (regexes_num + 1)
+ * sizeof (*regexes));
+ if (NULL == temp) {
log_err ("Out of memory.");
- exit (5);
+ return NULL;
}
+ regexes = temp;
+ regexes_num++;
re = regexes + (regexes_num - 1);
}
re = regex_new ();
+ if (NULL == re)
+ return -1;
for (i = 0; i < ci->children_num; ++i) {
oconfig_item_t *c = ci->children + i;