There can be 0 public addresses.
Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
}
pubip_list->num = wire->num;
+ if (wire->num == 0) {
+ pubip_list->ip = NULL;
+ *out = pubip_list;
+ return 0;
+ }
pubip_list->ip = talloc_array(pubip_list, struct ctdb_public_ip,
wire->num);
if (pubip_list->ip == NULL) {
{
int i;
- p->num = rand_int(32) + 1;
+ p->num = rand_int(32);
+ if (p->num == 0) {
+ p->ip = NULL;
+ return;
+ }
p->ip = talloc_array(mem_ctx, struct ctdb_public_ip, p->num);
assert(p->ip != NULL);
for (i=0; i<p->num; i++) {