Revision 0c6efcd5 src/PeerSet/peerset_ops.c

View differences:

src/PeerSet/peerset_ops.c
153 153
  memmove(&h->elements[pos + 1], &h->elements[pos] , ((h->n_elements++) - pos) * sizeof(struct peer *));
154 154

  
155 155
  e = malloc(sizeof(struct peer));
156
  h->elements[pos] = e;;
156
  h->elements[pos] = e;
157
  gettimeofday(&e->creation_timestamp, NULL);
157 158
  e->id = nodeid_dup(id);
158
  gettimeofday(&e->creation_timestamp,NULL);
159
  e->bmap = chunkID_set_init("type=bitmap");
160
  timerclear(&e->bmap_timestamp);
161 159
  e->metadata = NULL;
160
  e->user_data = NULL;
162 161

  
163 162
  return h->n_elements;
164 163
}
......
204 203
  if (i >= 0) {
205 204
    struct peer *e = h->elements[i];
206 205
    nodeid_free(e->id);
207
    chunkID_set_free(e->bmap);
206
    if (e->metadata)
207
	    free(e->metadata);
208
    if (e->user_data)
209
	    free(e->user_data);
208 210
    memmove(&h->elements[i], &h->elements[i+1], ((h->n_elements--) - (i+1)) * sizeof(struct peer *));
209 211
    free(e);
210 212

  
......
229 231
  for (i = 0; i < h->n_elements; i++) {
230 232
    struct peer *e = h->elements[i];
231 233
    nodeid_free(e->id);
232
    chunkID_set_free(e->bmap);
233 234
    if (e->metadata)
234 235
	    free(e->metadata);
236
    if (e->user_data)
237
	    free(e->user_data);
235 238
    free(e);
236 239
  }
237 240

  

Also available in: Unified diff