[ros-diffs] [janderwald] 44563: [REG] - Fix a memory leak and bug in the deletion routine. If the buffer value_name was had been smaller than the longest key, then deletion of all values would have failed. - Fixed by Amine Khaldi [XCOPY] - Remove unnecessary assignment - By Amine Khaldi

janderwald at svn.reactos.org janderwald at svn.reactos.org
Sun Dec 13 17:05:15 CET 2009


Author: janderwald
Date: Sun Dec 13 17:05:15 2009
New Revision: 44563

URL: http://svn.reactos.org/svn/reactos?rev=44563&view=rev
Log:
[REG]
- Fix a memory leak and bug in the deletion routine. If the buffer value_name was had been smaller than the longest key, then deletion of all values would have failed.
- Fixed by Amine Khaldi
[XCOPY]
- Remove unnecessary assignment
- By Amine Khaldi

Modified:
    trunk/reactos/base/applications/cmdutils/reg/reg.c
    trunk/reactos/base/applications/cmdutils/xcopy/xcopy.c

Modified: trunk/reactos/base/applications/cmdutils/reg/reg.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils/reg/reg.c?rev=44563&r1=44562&r2=44563&view=diff
==============================================================================
--- trunk/reactos/base/applications/cmdutils/reg/reg.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/cmdutils/reg/reg.c [iso-8859-1] Sun Dec 13 17:05:15 2009
@@ -295,20 +295,24 @@
             return 1;
         }
         maxValue++;
+        
         szValue = HeapAlloc(GetProcessHeap(),0,maxValue*sizeof(WCHAR));
+        if (!szValue) return 1;
 
         while (1)
         {
             count = maxValue;
-            rc = RegEnumValueW(subkey, 0, value_name, &count, NULL, NULL, NULL, NULL);
+            rc = RegEnumValueW(subkey, 0, szValue, &count, NULL, NULL, NULL, NULL);
             if (rc == ERROR_SUCCESS)
             {
-                rc = RegDeleteValueW(subkey,value_name);
+                rc = RegDeleteValueW(subkey,szValue);
                 if (rc != ERROR_SUCCESS)
                     break;
             }
             else break;
         }
+        
+        HeapFree(GetProcessHeap(), 0, szValue); 
         if (rc != ERROR_SUCCESS)
         {
             /* FIXME  delete failed */

Modified: trunk/reactos/base/applications/cmdutils/xcopy/xcopy.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/cmdutils/xcopy/xcopy.c?rev=44563&r1=44562&r2=44563&view=diff
==============================================================================
--- trunk/reactos/base/applications/cmdutils/xcopy/xcopy.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/cmdutils/xcopy/xcopy.c [iso-8859-1] Sun Dec 13 17:05:15 2009
@@ -261,10 +261,10 @@
     WINE_TRACE("Destination : '%s'\n", wine_dbgstr_w(supplieddestination));
 
     /* Extract required information from source specification */
-    rc = XCOPY_ProcessSourceParm(suppliedsource, sourcestem, sourcespec, flags);
+    XCOPY_ProcessSourceParm(suppliedsource, sourcestem, sourcespec, flags);
 
     /* Extract required information from destination specification */
-    rc = XCOPY_ProcessDestParm(supplieddestination, destinationstem,
+    XCOPY_ProcessDestParm(supplieddestination, destinationstem,
                                destinationspec, sourcespec, flags);
 
     /* Trace out the resulting information */




More information about the Ros-diffs mailing list