Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-19723

Memory leak in co_WinPosSetWindowPos()

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Minor
    • 0.4.15
    • Win32SS
    • None

    Description

      Hello,

      mega-maniac has pointed out in https://github.com/reactos/reactos/pull/7245 that there is a memory leak of VisBeforeJustClient in co_WinPosSetWindowPos().

      This observation is correct, but I found that there were additional corner cases when this variable, along with VisBefore, could possibly have a memory leak.

      In particular, if SWP_AGG_NOPOSCHANGE was the only "AGG status flag" specified or when SWP_NOCOPYBITS was specified to SetWindowPos(), both VisBefore and VisBeforeJustClient could potentially leak.

      Additionally, if VisAfter fails to initialize, VisBeforeJustClient leaks.

      And the new situation introduced by https://github.com/reactos/reactos/pull/7245 causes VisBeforeJustClient to leak if (WvrFlags & WVR_REDRAW) evaluates to true, e.g. when a scrollbar disappears or re-appears.

      This function could use a good refactoring, but at the very least, the function-scope PREGION variables should probably be cleaned up in the function's top-level scope, this will make it easy to know when those variables are valid and when they can be accessed. There are also no return statements in the middle of the function body once PREGION variables are created, so there shouldn't be an issue with conditional clean-up.

      Best Regards,
      Marek

      Attachments

        Activity

          People

            DougLyons DougLyons
            dusxmt dusxmt
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: