Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch from simclist to sys/queue.h? #2127

Open
frankmorgner opened this issue Oct 2, 2020 · 2 comments
Open

Switch from simclist to sys/queue.h? #2127

frankmorgner opened this issue Oct 2, 2020 · 2 comments

Comments

@frankmorgner
Copy link
Member

Problem Description

While handling some memory leaks in simclist, I've noticed that the code is quite complex considering that we are just using ordinary lists in OpenSC. It also looks like, simclist hasn't received any updates since 10 years, nor does it seem to be widely used in other projects.

Proposed Resolution

BSD based systems have sys/queue.h, which offers simple linked lists. I think this is all we need here. Copying only the header file to src/compat would allow us using this on other platforms, it doesn't use any other bsd dependencies.

POSIX has search.h for hash tables and binary trees, though some of that API is not so well designed, but I don't think we need this complexity.

@Jakuje
Copy link
Member

Jakuje commented Oct 6, 2020

Do you have some particular memory leak in mind? The simclist is not updated, but from my experience it just works. There are couple of changes over last years though. On the other hand, using sys queues is more standard these days also in Linux world. The advantage is that it is just macro based.

https://linux.die.net/man/3/queue

Grepping through the code, the lists are used only in src/pkcs11/pkcs11-global.c, src/pkcs11/slot.c, src/libopensc/ctx.c and cac, coolkey and idprime card drivers. Replacing this shold not be that hard.

@frankmorgner
Copy link
Member Author

most of the last changes on simclist.c were bug fixes, but that's not the point. The main problem is that the implementation is complex and none of us has deep insights for maintaining it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants