/** * A function to free a deltacloud_loadbalancer structure initially allocated * by deltacloud_get_loadbalancer_by_id(). * @param[in] lb The deltacloud_loadbalancer structure representing the * load balancer */ void deltacloud_free_loadbalancer(struct deltacloud_loadbalancer *lb) { if (lb == NULL) return; SAFE_FREE(lb->href); SAFE_FREE(lb->id); SAFE_FREE(lb->created_at); SAFE_FREE(lb->realm_href); SAFE_FREE(lb->realm_id); free_action_list(&lb->actions); free_address_list(&lb->public_addresses); free_list(&lb->listeners, struct deltacloud_loadbalancer_listener, free_listener); free_list(&lb->instances, struct deltacloud_loadbalancer_instance, free_lb_instance); }
static int do_sieve_error(int ret, sieve_interp_t *interp, void *script_context, void *message_context, strarray_t *imapflags, action_list_t *actions, notify_list_t *notify_list, /* notify_action_t *notify_action,*/ int lastaction, int implicit_keep, char *actions_string, const char *errmsg ) { if (ret != SIEVE_OK) { if (lastaction == -1) /* we never executed an action */ snprintf(actions_string+strlen(actions_string), ACTIONS_STRING_LEN-strlen(actions_string), "script execution failed: %s\n", errmsg ? errmsg : sieve_errstr(ret)); else snprintf(actions_string+strlen(actions_string), ACTIONS_STRING_LEN-strlen(actions_string), "%s action failed: %s\n", action_to_string(lastaction), errmsg ? errmsg : sieve_errstr(ret)); } /* Process notify actions */ if (interp->notify && notify_list) { notify_list_t *n = notify_list; int notify_ret = SIEVE_OK; while (n != NULL) { if (n->isactive) { lastaction = ACTION_NOTIFY; notify_ret = send_notify_callback(interp, message_context, script_context,n, actions_string, &errmsg); ret |= notify_ret; } n = n->next; } if (notify_list) free_notify_list(notify_list); notify_list = NULL; /* don't try any notifications again */ if (notify_ret != SIEVE_OK) return do_sieve_error(ret, interp, script_context, message_context, imapflags, actions, notify_list, lastaction, implicit_keep, actions_string, errmsg); } if ((ret != SIEVE_OK) && interp->execute_err) { char buf[ERR_BUF_SIZE]; if (lastaction == -1) /* we never executed an action */ snprintf(buf, ERR_BUF_SIZE, "%s", errmsg ? errmsg : sieve_errstr(ret)); else { if (interp->lastitem) { snprintf(buf, ERR_BUF_SIZE, "%s (%s): %s", action_to_string(lastaction), interp->lastitem, errmsg ? errmsg : sieve_errstr(ret)); } else { snprintf(buf, ERR_BUF_SIZE, "%s: %s", action_to_string(lastaction), errmsg ? errmsg : sieve_errstr(ret)); } } ret |= interp->execute_err(buf, interp->interp_context, script_context, message_context); } if (implicit_keep) { sieve_keep_context_t keep_context; int keep_ret; keep_context.imapflags = imapflags; lastaction = ACTION_KEEP; keep_ret = interp->keep(&keep_context, interp->interp_context, script_context, message_context, &errmsg); ret |= keep_ret; if (keep_ret == SIEVE_OK) snprintf(actions_string+strlen(actions_string), ACTIONS_STRING_LEN-strlen(actions_string), "Kept\n"); else { implicit_keep = 0; /* don't try an implicit keep again */ return do_sieve_error(ret, interp, script_context, message_context, imapflags, actions, notify_list, lastaction, implicit_keep, actions_string, errmsg); } } if (actions) free_action_list(actions); return ret; }