* causes problems... :-)
*/
static void ctdb_remove_orphaned_ifaces(struct ctdb_context *ctdb,
- struct ctdb_vnn *vnn,
- TALLOC_CTX *mem_ctx)
+ struct ctdb_vnn *vnn)
{
struct ctdb_iface *i;
/* For each interface, check if there's an IP using it. */
- for(i=ctdb->ifaces; i; i=i->next) {
+ i = ctdb->ifaces;
+ while (i != NULL) {
struct ctdb_vnn *tv;
bool found;
+ struct ctdb_iface *next = i->next;
/* Only consider interfaces named in the given VNN. */
if (!vnn_has_interface_with_name(vnn, i->name)) {
- continue;
+ goto next;
}
/* Is the "single IP" on this interface? */
(ctdb->single_ip_vnn->ifaces[0] != NULL) &&
(strcmp(i->name, ctdb->single_ip_vnn->ifaces[0]) == 0)) {
/* Found, next interface please... */
- continue;
+ goto next;
}
/* Search for a vnn with this interface. */
found = false;
if (!found) {
/* None of the VNNs are using this interface. */
DLIST_REMOVE(ctdb->ifaces, i);
- /* Caller will free mem_ctx when convenient. */
- talloc_steal(mem_ctx, i);
+ talloc_free(i);
}
+
+ next:
+ i = next;
}
}
static void do_delete_ip(struct ctdb_context *ctdb, struct ctdb_vnn *vnn)
{
- TALLOC_CTX *mem_ctx = talloc_new(ctdb);
-
DLIST_REMOVE(ctdb->vnn, vnn);
- ctdb_remove_orphaned_ifaces(ctdb, vnn, mem_ctx);
ctdb_vnn_unassign_iface(ctdb, vnn);
+ ctdb_remove_orphaned_ifaces(ctdb, vnn);
talloc_free(vnn);
- talloc_free(mem_ctx);
}
/*