Covscan report contains various memory leak defects which were marked
as important. I have spent some time analyzing them and although they
were marked as important, most of them are in error cases, so probably
nothing serious. Let's fix most of them anyway. The rest are false
positives, or too complicated to fix, or already fixed in master, or
simply I am unsure about them.
Relates: https://github.com/FreeRDP/FreeRDP/issues/6981
leaked_storage: Variable "fontBaseFile" going out of scope leaks the storage it points to.
leaked_storage: Variable "image" going out of scope leaks the storage it points to.
- fixed invalid, missing or additional arguments
- removed all type casts from arguments
- added missing (void*) typecasts for %p arguments
- use inttypes defines where appropriate
Since the current winpr implementation for overlapped operations is
incomplete and buggy, all affected functions will now fail if they are
called with a set FILE_FLAG_OVERLAPPED flag or a non-null pointer to
a OVERLAPPED structure.
winpr/nt:
- use proper one-time initialization on win32
- fix TestNtCreateFile
- fix broken/incomplete _RtlAnsiStringToUnicodeString
- unimplemented functions return appropriate error codes
winpr/pipe:
- improved TestPipeCreateNamedPipe
- rewrite the completely broken TestPipeCreateNamedPipeOverlapped test
rdtk:
- improve test and don't blindly return success
winpr/synch:
- fix race condition in TestSynchTimerQueue
winpr/ssspi:
- fix TestEnumerateSecurityPackages printf output
- fix TestQuerySecurityPackageInfo printf output
winpr/environment:
- fix GetEnvironmentStrings printf output
winpr/comm:
- unimplemented functions return appropriate error codes
winpr/io:
- unimplemented functions return appropriate error codes
winpr/thread:
- implement SwitchToThread() via sched_yield()
Although exported rdtk isn't really mature and stable yet therefore it is
not exported/installed anymore. In case FreeRDP is built without
static libraries librdtk is installed as part or the
FreeRDP-ShadowTargets exports as this is the only place it is used right
now.
If a target is linked against libraries with cmake
(target_link_libraries) and the libraries are not marked as PRIVATE
they are "exported" and in case a other target is linked against this
target it is also linked against *all* (not private) libraries.
Without declaring private libraries PRIVATE a lot of over linking
(linking against unneeded libraries) was done.