VirtualBox

Changeset 86509 in vbox for trunk/src


Ignore:
Timestamp:
Oct 9, 2020 5:37:05 PM (4 years ago)
Author:
vboxsync
Message:

VBoxSVC/Appliance: Fixed IMachine reference leak in Appliance::i_searchUniqueVMName(). bugref:9841

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ApplianceImpl.h

    r85283 r86509  
    131131     */
    132132    bool i_isApplianceIdle();
    133     HRESULT i_searchUniqueVMName(Utf8Str& aName) const;
     133    HRESULT i_searchUniqueVMName(Utf8Str &aName) const;
    134134    HRESULT i_ensureUniqueImageFilePath(const Utf8Str &aMachineFolder,
    135135                                        DeviceType_T aDeviceType,
     
    211211    void i_importMachineGeneric(const ovf::VirtualSystem &vsysThis,
    212212                                ComObjPtr<VirtualSystemDescription> &vsdescThis,
    213                                 ComPtr<IMachine> &pNewMachine,
     213                                ComPtr<IMachine> &pNewMachineRet,
    214214                                ImportStack &stack);
    215215    void i_importVBoxMachine(ComObjPtr<VirtualSystemDescription> &vsdescThis,
  • trunk/src/VBox/Main/src-server/ApplianceImpl.cpp

    r85363 r86509  
    966966}
    967967
    968 HRESULT Appliance::i_searchUniqueVMName(Utf8Str& aName) const
    969 {
    970     IMachine *machine = NULL;
     968HRESULT Appliance::i_searchUniqueVMName(Utf8Str &aName) const
     969{
     970    ComPtr<IMachine> ptrMachine;
    971971    char *tmpName = RTStrDup(aName.c_str());
    972972    int i = 1;
    973     while (mVirtualBox->FindMachine(Bstr(tmpName).raw(), &machine) != VBOX_E_OBJECT_NOT_FOUND)
     973    while (mVirtualBox->FindMachine(Bstr(tmpName).raw(), ptrMachine.asOutParam()) != VBOX_E_OBJECT_NOT_FOUND)
    974974    {
    975975        RTStrFree(tmpName);
  • trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp

    r85283 r86509  
    43164316 * about what needs cleaning up (to support rollback).
    43174317 *
    4318  * @param vsysThis OVF virtual system (machine) to import.
    4319  * @param vsdescThis  Matching virtual system description (machine) to import.
    4320  * @param pNewMachine out: Newly created machine.
    4321  * @param stack Cleanup stack for when this throws.
     4318 * @param       vsysThis        OVF virtual system (machine) to import.
     4319 * @param       vsdescThis      Matching virtual system description (machine) to import.
     4320 * @param[out]  pNewMachineRet  Newly created machine.
     4321 * @param       stack           Cleanup stack for when this throws.
     4322 *
     4323 * @throws HRESULT
    43224324 */
    43234325void Appliance::i_importMachineGeneric(const ovf::VirtualSystem &vsysThis,
    43244326                                       ComObjPtr<VirtualSystemDescription> &vsdescThis,
    4325                                        ComPtr<IMachine> &pNewMachine,
     4327                                       ComPtr<IMachine> &pNewMachineRet,
    43264328                                       ImportStack &stack)
    43274329{
     
    43394341    if (!stack.strPrimaryGroup.isEmpty() && stack.strPrimaryGroup != "/")
    43404342        Bstr(stack.strPrimaryGroup).detachTo(groups.appendedRaw());
     4343    ComPtr<IMachine> pNewMachine;
    43414344    rc = mVirtualBox->CreateMachine(Bstr(stack.strSettingsFilename).raw(),
    43424345                                    Bstr(stack.strNameVBox).raw(),
     
    43464349                                    pNewMachine.asOutParam());
    43474350    if (FAILED(rc)) throw rc;
     4351    pNewMachineRet = pNewMachine;
    43484352
    43494353    // set the description
     
    56195623        ComObjPtr<VirtualSystemDescription> vsdescThis = (*it1);
    56205624
    5621         ComPtr<IMachine> pNewMachine;
    5622 
    56235625        // there are two ways in which we can create a vbox machine from OVF:
    56245626        // -- either this OVF was written by vbox 3.2 or later, in which case there is a <vbox:Machine> element
     
    57375739
    57385740        // import vbox:machine or OVF now
     5741        ComPtr<IMachine> pNewMachine; /** @todo pointless */
    57395742        if (vsdescThis->m->pConfig)
    57405743            // vbox:Machine config
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