VirtualBox

Changeset 89603 in vbox


Ignore:
Timestamp:
Jun 10, 2021 1:34:13 PM (3 years ago)
Author:
vboxsync
Message:

Additions: X11: VMSVGA: prevent memory leak when accessing display name on resize, bugref#10028.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/x11/VBoxClient/display-svga-x11.cpp

    r89598 r89603  
    538538        for (int i = 0; i < iMonitorCount; ++i)
    539539        {
    540             int iMonitorID = getMonitorIdFromName(XGetAtomName(x11Context.pDisplayRandRMonitoring, pMonitorInfo[i].name));
     540            char *pszMonitorName = XGetAtomName(x11Context.pDisplayRandRMonitoring, pMonitorInfo[i].name);
     541            if (!pszMonitorName)
     542            {
     543                VBClLogError("queryMonitorPositions: skip monitor with unknown name %d\n", i);
     544                continue;
     545            }
     546
     547            int iMonitorID = getMonitorIdFromName(pszMonitorName);
     548            XFree((void *)pszMonitorName);
     549            pszMonitorName = NULL;
     550
    541551            if (iMonitorID >= x11Context.hOutputCount || iMonitorID == -1)
    542552            {
    543                 VBClLogInfo("queryMonitorPositions: skip monitor %d (id %d, %s) (w,h)=(%d,%d) (x,y)=(%d,%d)\n",
    544                         i, iMonitorID, XGetAtomName(x11Context.pDisplayRandRMonitoring, pMonitorInfo[i].name),
     553                VBClLogInfo("queryMonitorPositions: skip monitor %d (id %d) (w,h)=(%d,%d) (x,y)=(%d,%d)\n",
     554                        i, iMonitorID,
    545555                        pMonitorInfo[i].width, pMonitorInfo[i].height,
    546556                        pMonitorInfo[i].x, pMonitorInfo[i].y);
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette