Skip to content

Commit

Permalink
Fix sequence->clone, which was not cloning gap sets
Browse files Browse the repository at this point in the history
  • Loading branch information
apoelstra committed Apr 16, 2012
1 parent 47c0aed commit 18129ad
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions ramsey/sequence.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,22 @@ static ramsey_t *_sequence_clone (const ramsey_t *rt)

s->filter = malloc (s->max_filters * sizeof *s->filter);
s->value = malloc (s->max_length * sizeof *s->value);
if (s->filter == NULL || s->value == NULL)
{
free (s->filter);
free (s->value);
free (s);
return NULL;
}
if (old_s->gap_set)
{
s->gap_set = old_s->gap_set->clone (old_s->gap_set);
if (s->gap_set == NULL)
{
free (s);
return NULL;
}
}
memcpy (s->value, old_s->value, s->max_length * sizeof *s->value);
for (i = 0; i < s->n_filters; ++i)
s->filter[i] = old_s->filter[i]->clone (old_s->filter[i]);
Expand Down

0 comments on commit 18129ad

Please sign in to comment.