[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/kinit
From:       Carlo Segato <brandon.ml () gmail ! com>
Date:       2009-12-26 1:25:26
Message-ID: 1261790726.143417.15799.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1066140 by segato:

assigning _owner to owner after CopySid is definitively wrong :D
also use malloc/free instead of new/delete, apparently this is better when handling void pointers


 M  +6 -8      kinit_win.cpp  


--- trunk/KDE/kdelibs/kinit/kinit_win.cpp #1066139:1066140
@@ -67,15 +67,13 @@
            handle = _handle; 
            pid = _pid;
            DWORD length = GetLengthSid(_owner);
-           owner = (PSID) new BYTE[length];
+           owner = (PSID) malloc(length);
            CopySid(length, owner, _owner);
-           owner = _owner;
        }
 
        ~ProcessListEntry()
        {
-           // don't know why this crashes here.
-           // delete owner;
+           free(owner);
            owner = 0;
        }
        
@@ -122,7 +120,7 @@
     KUser user;
     K_UID processSid;
     DWORD sidLength = GetLengthSid(user.uid());
-    processSid = (PSID)new BYTE[sidLength];
+    processSid = (PSID) malloc(sidLength);
     CopySid(sidLength, processSid, user.uid());
 
     // Get a handle to the process.
@@ -164,9 +162,9 @@
                     GetTokenInformation(hToken, TokenUser, userStruct, size, &size);
 
                     sidLength = GetLengthSid(userStruct->User.Sid);
-                    delete processSid;
+                    free(processSid);
                     processSid = 0;
-                    processSid = (PSID)new BYTE[sidLength];
+                    processSid = (PSID) malloc(sidLength);
                     CopySid(sidLength, processSid, userStruct->User.Sid);
 
                     CloseHandle(hToken);
@@ -179,7 +177,7 @@
     {
         processList << new ProcessListEntry( hProcess, szProcessName, processID, processSid );
     }
-    delete processSid;
+    free(processSid);
 }
 
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic