Closed MikeNeilson closed 1 year ago
Probably good to have feedback from others.
My other thought was just convert this file to C++ and use std::unique_ptr to encapsulate the memory until released on assignment. the interface would still be C linkage so using programs wouldn't know. Would likely be cleaner but is a more drastic change and pulls in an additional library (libstdc++).
EDIT: to be clear, that would be c++17. so if anymore remembers auto_ptr, that's been deprecated since C++11.
I'm not in favor of using C++ unless we had a larger strategy to introduce C++ into the whole code base in a bigger way.
Oh no!, the forbidden
goto
! :)
I challenge you to find a cleaner way to do that in plain C.
An initial change to some code to prevent identified memory leaks.