child->right->parent = child;
gchild->right = node;
- if(gchild->right)
- gchild->right->parent = gchild;
+ gchild->right->parent = gchild;
gchild->left = child;
- if(gchild->left)
- gchild->left->parent = gchild;
- *superparent = gchild;
+ gchild->left->parent = gchild;
+ *superparent = gchild;
gchild->parent = parent;
#ifdef AVL_COUNT
node->count = AVL_CALC_COUNT(node);
child->left->parent = child;
gchild->left = node;
- if(gchild->left)
- gchild->left->parent = gchild;
+ gchild->left->parent = gchild;
gchild->right = child;
gchild->right->parent = gchild;
addressfamily = AF_UNSPEC;
else {
logger(LOG_ERR, "Invalid address family!");
+ free(afname);
return false;
}
free(afname);
if(!myself->incipher) {
logger(LOG_ERR, "Unrecognized cipher type!");
+ free(cipher);
return false;
}
}
return false;
}
- free(iface);
#else /* if !defined(SOL_SOCKET) || !defined(SO_BINDTODEVICE) */
logger(LOG_WARNING, "%s not supported on this platform", "BindToInterface");
#endif
memset(&ifr, 0, sizeof(ifr));
strncpy(ifr.ifr_ifrn.ifrn_name, iface, IFNAMSIZ);
+ ifr.ifr_ifrn.ifrn_name[IFNAMSIZ - 1] = 0;
+
if(ioctl(device_fd, SIOCGIFINDEX, &ifr)) {
close(device_fd);
- logger(LOG_ERR, "Can't find interface %s: %s", iface,
- strerror(errno));
+ logger(LOG_ERR, "Can't find interface %s: %s", ifr.ifr_ifrn.ifrn_name, strerror(errno));
return false;
}
sa.sll_ifindex = ifr.ifr_ifindex;
if(bind(device_fd, (struct sockaddr *) &sa, (socklen_t) sizeof(sa))) {
- logger(LOG_ERR, "Could not bind %s to %s: %s", device, iface, strerror(errno));
+ logger(LOG_ERR, "Could not bind %s to %s: %s", device, ifr.ifr_ifrn.ifrn_name, strerror(errno));
return false;
}