Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#44 rfbScreenCleanup() free frameBuffer issue.

closed
nobody
None
5
2012-12-05
2012-11-28
Anonymous
No

in rfbScreenCleanup(), free(ptr->frameBuffer); while not check null pointer. This may cause crash.
Because in my Android server example, to improve performance, I directly set screen->frameBuffer as fbmmap!
So in cleanup(), I munmap(fbmmap), then this memory pointer is not valid anymore. And then crash occurs while followed invoking rfbScreenCleanup().
To avoid crash, after munmap(fbmmap), I have to allocate some bytes memory and assign it to screen->frameBuffer for free.
I think in rfbScreenCleanup(), or do not free frameBuffer and let it free by userself or check it's validity before call free.

Discussion

  • In POSIX C, free(NULL) is a valid no-operation. So after munmap() you should set frameBuffer to NULL.

     
  • Morrowind.Tse
    Morrowind.Tse
    2012-12-05

    Set frameBuffer to NULL is OK. Thank you!

     
    • status: open --> closed