Skip to content

Generalise zqueue to non-string data pointers, fix memory leaks#806

Merged
zakird merged 1 commit intozmap:mainfrom
droe:droe/fix-zqueue
Mar 4, 2024
Merged

Generalise zqueue to non-string data pointers, fix memory leaks#806
zakird merged 1 commit intozmap:mainfrom
droe:droe/fix-zqueue

Conversation

@droe
Copy link
Contributor

@droe droe commented Mar 3, 2024

Make zqueue store a void * instead of a char *.

Remove internal strdup of data ptr in push_back; instead, take ownership of the pointer and move the strdup to the callsite in ztee.

This also fixes a one-off memory leak in ztee where first_line was never freed after getting pushed onto the queue.

While here, fix memory leaks in the unused get_front and get_back functions.

Generalisation of zqueue motivated by wanting to use zqueue for droe/netmap-arp.

Make zqueue store a void * instead of a char *.

Remove internal strdup of data ptr in push_back; instead, take ownership
of the pointer and move the strdup to the callsite in ztee.

This also fixes a one-off memory leak in ztee where first_line was never
freed after getting pushed onto the queue.

While here, fix memory leaks in the unused get_front and get_back
functions.
@zakird zakird merged commit 060cff8 into zmap:main Mar 4, 2024
@droe droe deleted the droe/fix-zqueue branch March 11, 2024 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants