Menu

#46 Minor fixes

Added
closed-accepted
nobody
None
5
2015-04-07
2014-01-02
No

The following patch fixes:
- A possible double free and freed memory dereference as well as some other side effects in Util.cpp (if the allocation of pwText failed, it tried to free it and continue instead of returning).
- A silly warning caused by extra parentheses in gbGfx.cpp
- An undefined behavior in elf.cpp. I had to guess what the intention was. As it was this statement "(data++);" I assumed that being the dereferenced value unused, it wasn't the pointer but the object pointed to the one to increase.
- Incorrect use of memset (sizeof(u8
) instead of the amount of u8 elements in the array of data) in SDL.cpp.

1 Attachments

Discussion

  • Squall Leonhart

    Squall Leonhart - 2014-01-02

    V668 There is no sense in testing the 'pwText' pointer against null, as the memory was allocated using the 'new' operator. The exception will be generated in the case of memory allocation error. util.cpp 456
    V668 There is no sense in testing the 'pwText' pointer against null, as the memory was allocated using the 'new' operator. The exception will be generated in the case of memory allocation error. util.cpp 503

     
  • Mario Rugiero

    Mario Rugiero - 2014-01-03

    Well, the check was there in the original, but it tried to free pwText instead (which is by itself weird, as it tried to free ONLY if null).
    I have nothing against modifying the patch to avoid even checking for null, if you want.

     
  • Squall Leonhart

    Squall Leonhart - 2015-04-07
    • status: open --> closed-accepted
     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.