diff options
Diffstat (limited to 'ctl-lib/ctl-action.c')
-rw-r--r-- | ctl-lib/ctl-action.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ctl-lib/ctl-action.c b/ctl-lib/ctl-action.c index 0bd9c7b..2b0813b 100644 --- a/ctl-lib/ctl-action.c +++ b/ctl-lib/ctl-action.c @@ -373,13 +373,16 @@ int AddActionsToSection(AFB_ApiT apiHandle, CtlSectionT *section, json_object *a CtlActionT *savedActions = section->actions; CtlActionT *newActions = ActionConfig(apiHandle, actionsJ, exportApi); - while(savedActions[actionsNb].uid) + while(savedActions[idx++].uid) { actionsNb++; - while(newActions[actionsNb].uid) + } + idx = 0; + while(newActions[idx++].uid) { actionsNb++; - + } + /* Allocate one more, NULL uid marks the end of the table */ actions = calloc(actionsNb + 1, sizeof(CtlActionT)); - + idx = 0; while(savedActions[idx].uid) { actions[idx] = savedActions[idx]; idx++; |