VirtualBox

Ignore:
Timestamp:
Jan 18, 2024 3:32:39 PM (13 months ago)
Author:
vboxsync
Message:

Shared Clipboard/Transfer: Made destroying the transfers easier to use by also free'ing the object within ShClTransferDestroy(). Should also fix the memory leaks within the testcase. bugref:9437

File:
1 edited

Legend:

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

    r100676 r102954  
    11621162 *
    11631163 * @returns VBox status code.
    1164  * @param   pTransferCtx                Clipboard transfer to destroy.
     1164 * @param   pTransfer           Clipboard transfer to destroy.
     1165 *                              The pointer will be invalid after return.
    11651166 */
    11661167int ShClTransferDestroy(PSHCLTRANSFER pTransfer)
     
    11951196
    11961197    ShClEventSourceDestroy(&pTransfer->Events);
     1198
     1199    RTMemFree(pTransfer);
     1200    pTransfer = NULL;
    11971201
    11981202    LogFlowFuncLeave();
     
    26792683    RTListForEachSafe(&pTransferCtx->List, pTransfer, pTransferNext, SHCLTRANSFER, Node)
    26802684    {
     2685        shclTransferCtxTransferRemoveAndUnregister(pTransferCtx, pTransfer);
    26812686        ShClTransferDestroy(pTransfer);
    2682 
    2683         shclTransferCtxTransferRemoveAndUnregister(pTransferCtx, pTransfer);
    2684 
    2685         RTMemFree(pTransfer);
    2686         pTransfer = NULL;
    26872687    }
    26882688
     
    32353235
    32363236            shclTransferCtxTransferRemoveAndUnregister(pTransferCtx, pTransfer);
    3237 
    32383237            ShClTransferDestroy(pTransfer);
    3239 
    3240             RTMemFree(pTransfer);
    3241             pTransfer = NULL;
    32423238        }
    32433239        else
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