VirtualBox

Changeset 60391 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Apr 8, 2016 9:29:58 AM (9 years ago)
Author:
vboxsync
Message:

GuestControl/service.cpp: Follow-up for r106475 (bugref:7179): Explicitly handle std::bad_alloc, destroy service object if constructor has thrown, touched copyright.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/GuestControl/service.cpp

    r60389 r60391  
    55
    66/*
    7  * Copyright (C) 2011-2014 Oracle Corporation
     7 * Copyright (C) 2011-2016 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    16111611        else
    16121612        {
    1613             Service *apService = NULL;
     1613            Service *pService = NULL;
    16141614            /* No exceptions may propagate outside. */
    1615             try {
    1616                 apService = new Service(pTable->pHelpers);
    1617             } catch (int rcThrown) {
     1615            try
     1616            {
     1617                pService = new Service(pTable->pHelpers);
     1618            }
     1619            catch (int rcThrown)
     1620            {
    16181621                rc = rcThrown;
    1619             } catch (...) {
    1620                 rc = VERR_UNRESOLVED_ERROR;
     1622            }
     1623            catch(std::bad_alloc &)
     1624            {
     1625                rc = VERR_NO_MEMORY;
    16211626            }
    16221627
     
    16401645
    16411646                /* Service specific initialization. */
    1642                 pTable->pvService = apService;
     1647                pTable->pvService = pService;
     1648            }
     1649            else
     1650            {
     1651                if (pService)
     1652                {
     1653                    delete pService;
     1654                    pService = NULL;
     1655                }
    16431656            }
    16441657        }
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