VirtualBox

Changeset 86402 in vbox for trunk


Ignore:
Timestamp:
Oct 1, 2020 8:26:56 PM (4 years ago)
Author:
vboxsync
Message:

tstVBoxAPIXPCOM: Fix leak in VM listing. Added VBOX_XPCOM_HOME hack to it runs as a testcase. bugref:9841

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/testcase/tstVBoxAPIXPCOM.cpp

    r82968 r86402  
    105105     */
    106106    IMachine **machines = NULL;
    107     PRUint32 machineCnt = 0;
    108 
    109     rc = virtualBox->GetMachines(&machineCnt, &machines);
     107    PRUint32 cMachines = 0;
     108
     109    rc = virtualBox->GetMachines(&cMachines, &machines);
    110110    if (NS_SUCCEEDED(rc))
    111111    {
     
    113113         * Iterate through the collection
    114114         */
    115         for (PRUint32 i = 0; i < machineCnt; ++ i)
     115        for (PRUint32 i = 0; i < cMachines; ++ i)
    116116        {
    117117            IMachine *machine = machines[i];
     
    168168            }
    169169        }
     170        nsMemory::Free(machines);
    170171    }
    171172    printf("----------------------------------------------------\n\n");
     
    433434///////////////////////////////////////////////////////////////////////////////
    434435
    435 int main()
     436int main(int argc, char **argv)
    436437{
    437438    /*
     
    450451        return -1;
    451452    }
     453
     454#if 1 /* Please ignore this! It is very very crude. */
     455    char szTmp[8192];
     456    if (!getenv("VBOX_XPCOM_HOME"))
     457    {
     458        strcpy(szTmp, argv[0]);
     459        *strrchr(szTmp, '/') = '\0';
     460        strcat(szTmp, "/..");
     461        fprintf(stderr, "tstVBoxAPIXPCOM: VBOX_XPCOM_HOME is not set, using '%s' instead\n", szTmp);
     462        setenv("VBOX_XPCOM_HOME", szTmp, 1);
     463    }
     464#endif
     465    (void)argc; (void)argv;
    452466
    453467    nsresult rc;
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