Skip to content
This repository has been archived by the owner on Apr 20, 2023. It is now read-only.

Fix memory leak and compiler warnings #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GoGoOtaku
Copy link
Contributor

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.c IMAGE_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.

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

Successfully merging this pull request may close these issues.

1 participant