The inline array used to store, the configured messages per event in the
SPOE agent structure, is replaced by a dynamic array, allocated during the
configuration parsing. The main purpose of this change is to be able to move
all stuff regarding the SPOE filter and applet in the C file.
The related issue is #2502.
unsigned int flags; /* SPOE_FL_* */
unsigned int max_frame_size; /* Maximum frame size for this agent, before any negotiation */
- struct list events[SPOE_EV_EVENTS]; /* List of SPOE messages that will be sent
+ struct list *events; /* List of SPOE messages that will be sent
* for each supported events */
struct list groups; /* List of available SPOE groups */
LIST_DELETE(&grp->list);
spoe_release_group(grp);
}
+ free(agent->events);
free(agent->engine_id);
free(agent);
}
curagent->flags = SPOE_FL_PIPELINING;
curagent->max_frame_size = SPOP_MAX_FRAME_SIZE;
+ if ((curagent->events = calloc(SPOE_EV_EVENTS, sizeof(*curagent->events))) == NULL) {
+ ha_alert("parsing [%s:%d] : out of memory.\n", file, linenum);
+ err_code |= ERR_ALERT | ERR_ABORT;
+ goto out;
+ }
+
for (i = 0; i < SPOE_EV_EVENTS; ++i)
LIST_INIT(&curagent->events[i]);
LIST_INIT(&curagent->groups);