VirtualBox

Changeset 39103 in vbox


Ignore:
Timestamp:
Oct 25, 2011 6:25:32 AM (13 years ago)
Author:
vboxsync
Message:

Audio/coreaudio: more convenient memory allocation and release operations, initialization of variables.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Audio/coreaudio.c

    r33540 r39103  
    378378    pszTmp = CFStringGetCStringPtr(pCFString, kCFStringEncodingUTF8);
    379379    if (pszTmp)
     380    {
    380381        /* On success make a copy */
    381382        pszResult = RTStrDup(pszTmp);
     383    }
    382384    else
    383385    {
    384386        /* If the pointer isn't available directly, we have to make a copy. */
    385387        cLen = CFStringGetLength(pCFString) + 1;
    386         pszResult = RTMemAlloc(cLen * sizeof(char));
     388        pszResult = RTMemAllocZTag(cLen * sizeof(char), RTSTR_TAG);
    387389        if (!CFStringGetCString(pCFString, pszResult, cLen, kCFStringEncodingUTF8))
    388390        {
    389             RTMemFree(pszResult);
     391            RTStrFree(pszResult);
    390392            pszResult = NULL;
    391393        }
     
    641643    UInt32 uFlag = 0; /* for setting flags */
    642644    CFStringRef name; /* for the temporary device name fetching */
    643     char *pszName;
    644     char *pszUID;
     645    char *pszName = NULL;
     646    char *pszUID = NULL;
    645647    ComponentDescription cd; /* description for an audio component */
    646648    Component cp; /* an audio component */
     
    14641466    UInt32 uFlag = 0; /* for setting flags */
    14651467    CFStringRef name; /* for the temporary device name fetching */
    1466     char *pszName;
    1467     char *pszUID;
     1468    char *pszName = NULL;
     1469    char *pszUID = NULL;
    14681470    ComponentDescription cd; /* description for an audio component */
    14691471    Component cp; /* an audio component */
     
    15161518            if (pszName && pszUID)
    15171519                LogRel(("CoreAudio: Using input device: %s (UID: %s)\n", pszName, pszUID));
    1518             RTStrFree(pszUID);
     1520            if (pszUID)
     1521                RTStrFree(pszUID);
    15191522        }
    1520         RTStrFree(pszName);
     1523        if (pszName)
     1524            RTStrFree(pszName);
    15211525    }
    15221526    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