Index: /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp
===================================================================
--- /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp	(revision 30048)
+++ /trunk/src/VBox/Additions/common/VBoxService/VBoxServiceVMInfo-win.cpp	(revision 30049)
@@ -37,4 +37,7 @@
 
 
+/*******************************************************************************
+*   Structures and Typedefs                                                    *
+*******************************************************************************/
 /** Structure for storing the looked up user information. */
 typedef struct
@@ -44,4 +47,5 @@
     WCHAR wszLogonDomain[_MAX_PATH];
 } VBOXSERVICEVMINFOUSER, *PVBOXSERVICEVMINFOUSER;
+
 /** Structure for the file information lookup. */
 typedef struct
@@ -50,4 +54,5 @@
     char *pszFileName;
 } VBOXSERVICEVMINFOFILE, *PVBOXSERVICEVMINFOFILE;
+
 /** Structure for process information lookup. */
 typedef struct
@@ -66,8 +71,4 @@
 void VBoxServiceVMInfoWinProcessesFree(PVBOXSERVICEVMINFOPROC paProcs);
 
-
-/*******************************************************************************
-*   Global Variables                                                           *
-*******************************************************************************/
 
 
@@ -406,5 +407,5 @@
                                                &cbRet))
                 {
-                    if(cbRet)
+                    if (cbRet)
                         iState = *pBuffer;
                     VBoxServiceVerbose(3, "VMInfo/Users:  Account User=%ls, WTSConnectState=%d\n",
@@ -449,6 +450,6 @@
  *
  * @returns VBox status code.
- * @param   ppszUserList    Where to store the user list (separated by commas).  Must be
- *                          freed with RTStrFree().
+ * @param   ppszUserList    Where to store the user list (separated by commas).
+ *                          Must be freed with RTStrFree().
  * @param   pcUsersInList   Where to store the number of users in the list.
  */
@@ -457,14 +458,13 @@
     PLUID       paSessions = NULL;
     ULONG       cSession = 0;
-    NTSTATUS    r = 0;
 
     /* This function can report stale or orphaned interactive logon sessions
        of already logged off users (especially in Windows 2000). */
-    r = LsaEnumerateLogonSessions(&cSession, &paSessions);
+    NTSTATUS rcNt = LsaEnumerateLogonSessions(&cSession, &paSessions);
     VBoxServiceVerbose(3, "VMInfo/Users: Found %ld users\n", cSession);
-    if (r != STATUS_SUCCESS)
-    {
-        VBoxServiceError("VMInfo/Users: LsaEnumerate failed with %lu\n", LsaNtStatusToWinError(r));
-        return RTErrConvertFromWin32(LsaNtStatusToWinError(r));
+    if (rcNt != STATUS_SUCCESS)
+    {
+        VBoxServiceError("VMInfo/Users: LsaEnumerate failed with %lu\n", LsaNtStatusToWinError(rcNt));
+        return RTErrConvertFromWin32(LsaNtStatusToWinError(rcNt));
     }
 
@@ -484,5 +484,5 @@
                 {
                     rc = RTStrAAppend(ppszUserList, ",");
-                    AssertRCReturn(rc, rc);
+                    AssertRCBreakStmt(rc, RTStrFree(*ppszUserList));
                 }
 
@@ -495,8 +495,8 @@
                     rc = RTStrAAppend(ppszUserList, pszTemp);
                     RTMemFree(pszTemp);
-                    AssertRCReturn(rc, rc);
                 }
                 else
-                    RTStrAAppend(ppszUserList, "<string-convertion-error>");
+                    rc = RTStrAAppend(ppszUserList, "<string-convertion-error>");
+                AssertRCBreakStmt(rc, RTStrFree(*ppszUserList));
             }
         }
