VirtualBox

Changeset 87084 in vbox for trunk


Ignore:
Timestamp:
Dec 10, 2020 4:37:53 PM (4 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
141867
Message:

Shared Clipboard: Check if XtMalloc actually worked in clipCreateX11Targets().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/GuestHost/SharedClipboard/clipboard-x11.cpp

    r87082 r87084  
    13551355                                int *piFormatReturn)
    13561356{
    1357     const unsigned cFixedTargets = 3;
    1358 
    1359     Atom *atomTargets = (Atom *)XtMalloc((SHCL_MAX_X11_FORMATS + cFixedTargets) * sizeof(Atom));
     1357    const unsigned cFixedTargets = 3; /* See below. */
     1358
     1359    Atom *pAtomTargets = (Atom *)XtMalloc((SHCL_MAX_X11_FORMATS + cFixedTargets) * sizeof(Atom));
     1360    if (!pAtomTargets)
     1361        return VERR_NO_MEMORY;
     1362
    13601363    unsigned cTargets = 0;
    13611364    SHCLX11FMTIDX idxFmt = NIL_CLIPX11FORMAT;
     
    13651368        if (idxFmt != NIL_CLIPX11FORMAT)
    13661369        {
    1367             atomTargets[cTargets] = clipAtomForX11Format(pCtx, idxFmt);
     1370            pAtomTargets[cTargets] = clipAtomForX11Format(pCtx, idxFmt);
    13681371            ++cTargets;
    13691372        }
     
    13711374
    13721375    /* We always offer these fixed targets. */
    1373     atomTargets[cTargets]     = clipGetAtom(pCtx, "TARGETS");
    1374     atomTargets[cTargets + 1] = clipGetAtom(pCtx, "MULTIPLE");
    1375     atomTargets[cTargets + 2] = clipGetAtom(pCtx, "TIMESTAMP");
     1376    pAtomTargets[cTargets]     = clipGetAtom(pCtx, "TARGETS");
     1377    pAtomTargets[cTargets + 1] = clipGetAtom(pCtx, "MULTIPLE");
     1378    pAtomTargets[cTargets + 2] = clipGetAtom(pCtx, "TIMESTAMP");
    13761379
    13771380    *atomTypeReturn = XA_ATOM;
    1378     *pValReturn = (XtPointer)atomTargets;
     1381    *pValReturn = (XtPointer)pAtomTargets;
    13791382    *pcLenReturn = cTargets + cFixedTargets;
    13801383    *piFormatReturn = 32;
Note: See TracChangeset for help on using the changeset viewer.

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