VirtualBox

Changeset 24306 in vbox for trunk/src/VBox/Additions/common


Ignore:
Timestamp:
Nov 4, 2009 9:52:10 AM (15 years ago)
Author:
vboxsync
Message:

VBoxGuestR3Lib: Fixes for memory (de)allocation in host version reporting (provided by Huihong Luo).

Location:
trunk/src/VBox/Additions/common/VBoxGuestLib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibHostVersion.cpp

    r24023 r24306  
    8585    Assert(ppszHostVersion);
    8686    Assert(ppszGuestVersion);
     87
     88    *ppszHostVersion = NULL;
     89    *ppszGuestVersion = NULL;
    8790
    8891    /* We assume we have an update initially.
     
    171174    if (RT_FAILURE(rc))
    172175    {
    173         VbglR3GuestPropReadValueFree(*ppszHostVersion);
    174         VbglR3GuestPropReadValueFree(*ppszGuestVersion);
     176        if (*ppszHostVersion)
     177            VbglR3GuestPropReadValueFree(*ppszHostVersion);
     178        if (*ppszGuestVersion)
     179            VbglR3GuestPropReadValueFree(*ppszGuestVersion);
    175180    }
    176181    return rc;
  • trunk/src/VBox/Additions/common/VBoxGuestLib/VBoxGuestR3LibMisc.cpp

    r23893 r24306  
    223223
    224224    /* Still no luck? Then try the old xVM paths ... */
    225     if (FAILED(r))
     225    if (r != ERROR_SUCCESS)
    226226    {
    227227        r = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Sun\\xVM VirtualBox Guest Additions", 0, KEY_READ, &hKey);
     
    236236
    237237    /* Did we get something worth looking at? */
    238     if (SUCCEEDED(r))
     238    if (r == ERROR_SUCCESS)
    239239    {
    240240        /* Version. */
     
    262262        }
    263263    }
    264     rc = RTErrConvertFromWin32(r);
     264    else
     265    {
     266        /* No registry entries found, return the compile-time version string atm. */
     267        /* Version. */
     268        if (ppszVer)
     269            rc = RTStrAPrintf(ppszVer, "%s", VBOX_VERSION_STRING);
     270        /* Revision. */
     271        if (ppszRev)
     272            rc = RTStrAPrintf(ppszRev, "%s", VBOX_SVN_REV);
     273    }
    265274    if (NULL != hKey)
    266275        RegCloseKey(hKey);
    267 #else /* !RT_OS_WINDOWS */
     276# else /* !RT_OS_WINDOWS */
    268277    /* On non-Windows platforms just return the compile-time version string atm. */
    269278    /* Version. */
     
    273282    if (ppszRev)
    274283        rc = RTStrAPrintf(ppszRev, "%s", VBOX_SVN_REV);
    275 #endif /* !RT_OS_WINDOWS */
    276     return rc;
    277 }
     284# endif /* !RT_OS_WINDOWS */
     285    return rc;
     286}
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