(list_data_dup): Bugfix: *ptr was not assigned.
Showing
1 changed file
with
3 additions
and
6 deletions
... | @@ -422,13 +422,10 @@ curitem_p (void *owner, void *item) | ... | @@ -422,13 +422,10 @@ curitem_p (void *owner, void *item) |
422 | static int | 422 | static int |
423 | list_data_dup (void **ptr, void *owner) | 423 | list_data_dup (void **ptr, void *owner) |
424 | { | 424 | { |
425 | struct list_iterator *itr = owner; | 425 | *ptr = malloc (sizeof (struct list_iterator)); |
426 | struct list_iterator *clone; | 426 | if (*ptr == NULL) |
427 | clone = malloc (sizeof *itr); | ||
428 | if (clone == NULL) | ||
429 | return ENOMEM; | 427 | return ENOMEM; |
430 | /* let the assignement operator copy the elements. */ | 428 | memcpy (*ptr, owner, sizeof (struct list_iterator)); |
431 | *clone = *itr; | ||
432 | return 0; | 429 | return 0; |
433 | } | 430 | } |
434 | 431 | ... | ... |
-
Please register or sign in to post a comment