This looks bigger than it actually is. From what I can tell I have now fixed every memory leak in pev. At least with my test executable (putty.exe). None of them were major obviously but better have them fixed.
I also fixed all warnings GCC gave me (except for libudis86 stuff).
The reason why I put pe_ctx_t and pe_resources_t into their own headers is because redefinition of typedefs is technically a C11 feature. This lead to a warning every time pe.h was used.
Another warning I fixed is harder to explain because it is platform specific: In hashes.cIMAGE_ORDINAL_FLAG64 was used as a macro with the UL postfix aka unsigned long. This was then (rightfully) fed into PRIu64 which is a macro to print a 64 bit integer based on the current system. This works fine under windows as under Windows an uint64_t is extended to unsigned long int. Under Linux however it extents to unsigned long long int. Technically both are 64 bit under Linux but it still gives a Wformat warning (I don't make the rules). Thus I have changed the macro into a static const uint64_t. This is more in line with what we want (specifically an unsigned 64 bit integer), it's more platform independent and as a side effect it's also more debugger friendly. The cast to uint64_t of the logic and result is for the same reason but should have no effect on the actual compiled library.
The rest of the warnings are more self explanatory.
This looks bigger than it actually is. From what I can tell I have now fixed every memory leak in pev. At least with my test executable (putty.exe). None of them were major obviously but better have them fixed. I also fixed all warnings GCC gave me (except for libudis86 stuff).
The reason why I put
pe_ctx_t
andpe_resources_t
into their own headers is because redefinition of typedefs is technically a C11 feature. This lead to a warning every timepe.h
was used.Another warning I fixed is harder to explain because it is platform specific: In
hashes.c
IMAGE_ORDINAL_FLAG64
was used as a macro with theUL
postfix aka unsigned long. This was then (rightfully) fed into PRIu64 which is a macro to print a 64 bit integer based on the current system. This works fine under windows as under Windows anuint64_t
is extended tounsigned long int
. Under Linux however it extents tounsigned long long int
. Technically both are 64 bit under Linux but it still gives a Wformat warning (I don't make the rules). Thus I have changed the macro into astatic const uint64_t
. This is more in line with what we want (specifically an unsigned 64 bit integer), it's more platform independent and as a side effect it's also more debugger friendly. The cast touint64_t
of the logic and result is for the same reason but should have no effect on the actual compiled library.The rest of the warnings are more self explanatory.