Revision 10ddaca7 src/PeerSet/peerset_ops.c

View differences:

src/PeerSet/peerset_ops.c
236 236

  
237 237
  h->n_elements = 0;
238 238
  h->size = size;
239
  h->elements = realloc(h->elements, size * sizeof(struct peer *));
239
  if (h->size)
240
	  h->elements = realloc(h->elements, size * sizeof(struct peer *));
241
  else
242
  {
243
	  free(h->elements);
244
	  h->elements = NULL;
245
  }
240 246
  if (h->elements == NULL) {
241 247
    h->size = 0;
242 248
  }

Also available in: Unified diff