ea4k / klog

KLog is a multiplatform free hamradio logger. It runs natively on Linux, macOS and Windows.
https://www.klog.xyz
GNU General Public License v3.0
74 stars 24 forks source link

Replace pointers with smart pointers #639

Open ikbenkous opened 9 months ago

ikbenkous commented 9 months ago

Klog has some memory issues. There's a double free() somewhere and valgrind has a field day listing off issues. Traditional unsafe C-style pointers are used throughout the codebase, even in places to denote ownership (like class members).

The Core CPP Guidelines have some input regarding this: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#S-resource Specifically R20 through R30 seem good advice.

Since Klog is compiled with c++11 (which has smart pointers), I think unsafe pointers can slowly be replaced where it makes sense to do so! DO NOTE: R.30 and F.7 regarding function arguments: https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rr-weak_ptr https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rf-smart

This seems like an enhancement that could go well with the header guard improvements to improve the codebase quality!

ikbenkous commented 9 months ago

I suggest that this issue is assigned to milestone Klog-2.4. Since #624 is assigned there as well.

ikbenkous commented 2 months ago

See #643