Skip to content

Commit

Permalink
Merge pull request #79 from huaxinliao/Double_free
Browse files Browse the repository at this point in the history
Fix double free error
  • Loading branch information
jserv authored Dec 8, 2024
2 parents a90b142 + 232542c commit af56522
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 6 deletions.
1 change: 0 additions & 1 deletion include/twin_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,6 @@ void _twin_path_sfinish(twin_path_t *path);
typedef struct _twin_queue {
struct _twin_queue *next;
struct _twin_queue *order;
bool walking;
bool deleted;
} twin_queue_t;

Expand Down
5 changes: 0 additions & 5 deletions src/queue.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ void _twin_queue_insert(twin_queue_t **head,
break;
new->next = *prev;
new->order = 0;
new->walking = false;
new->deleted = false;
*prev = new;
}
Expand Down Expand Up @@ -54,8 +53,6 @@ void _twin_queue_delete(twin_queue_t **head, twin_queue_t *old)
{
_twin_queue_remove(head, old);
old->deleted = true;
if (!old->walking)
free(old);
}

twin_queue_t *_twin_queue_set_order(twin_queue_t **head)
Expand All @@ -64,7 +61,6 @@ twin_queue_t *_twin_queue_set_order(twin_queue_t **head)

for (twin_queue_t *q = first; q; q = q->next) {
q->order = q->next;
q->walking = true;
}
return first;
}
Expand All @@ -76,7 +72,6 @@ void _twin_queue_review_order(twin_queue_t *first)
for (q = first; q; q = o) {
o = q->order;
q->order = 0;
q->walking = false;
if (q->deleted)
free(q);
}
Expand Down

0 comments on commit af56522

Please sign in to comment.