Rob Shearman : rpcrt4: Don' t call VirtualFree with MEM_RELEASE and non-zero size.

Alexandre Julliard julliard at winehq.org
Tue Sep 23 09:28:59 CDT 2008


Module: wine
Branch: master
Commit: 62a1beebbf7165f947b7799ab53fbe0c56bd9d3b
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=62a1beebbf7165f947b7799ab53fbe0c56bd9d3b

Author: Rob Shearman <robertshearman at gmail.com>
Date:   Tue Sep 23 13:31:54 2008 +0100

rpcrt4: Don't call VirtualFree with MEM_RELEASE and non-zero size.

The calls fail with ERROR_INVALID_PARAMETER. Instead just call with a
zero size which performs the intended function.

---

 dlls/rpcrt4/cstub.c |    8 ++------
 1 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/dlls/rpcrt4/cstub.c b/dlls/rpcrt4/cstub.c
index c790ad5..869265f 100644
--- a/dlls/rpcrt4/cstub.c
+++ b/dlls/rpcrt4/cstub.c
@@ -221,9 +221,7 @@ void create_delegating_vtbl(DWORD num_methods)
         if(current_vtbl.table && current_vtbl.table->ref == 0)
         {
             TRACE("freeing old table\n");
-            VirtualFree(current_vtbl.table->methods,
-                        (current_vtbl.table->size - 3) * sizeof(vtbl_method_t),
-                        MEM_RELEASE);
+            VirtualFree(current_vtbl.table->methods, 0, MEM_RELEASE);
             HeapFree(GetProcessHeap(), 0, current_vtbl.table);
         }
         size = (num_methods - 3) * sizeof(vtbl_method_t);
@@ -258,9 +256,7 @@ static void release_delegating_vtbl(IUnknownVtbl *vtbl)
     if(table->ref == 0 && table != current_vtbl.table)
     {
         TRACE("... and we're not current so free'ing\n");
-        VirtualFree(current_vtbl.table->methods,
-                    (current_vtbl.table->size - 3) * sizeof(vtbl_method_t),
-                    MEM_RELEASE);
+        VirtualFree(current_vtbl.table->methods, 0, MEM_RELEASE);
         HeapFree(GetProcessHeap(), 0, table);
     }
     LeaveCriticalSection(&delegating_vtbl_section);




More information about the wine-cvs mailing list