James Hawkins : kernel32: Free the resource data if a matching resource exists and we choose not to overwrite the existing resource .

Alexandre Julliard julliard at winehq.org
Thu Dec 17 10:37:09 CST 2009


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

Author: James Hawkins <truiken at gmail.com>
Date:   Wed Dec 16 19:05:18 2009 -0800

kernel32: Free the resource data if a matching resource exists and we choose not to overwrite the existing resource.

---

 dlls/kernel32/resource.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/dlls/kernel32/resource.c b/dlls/kernel32/resource.c
index d405b95..76d2741 100644
--- a/dlls/kernel32/resource.c
+++ b/dlls/kernel32/resource.c
@@ -810,7 +810,7 @@ static BOOL update_add_resource( QUEUEDUPDATES *updates, LPCWSTR Type, LPCWSTR N
     if (existing)
     {
         if (!overwrite_existing)
-            return TRUE;
+            return FALSE;
         list_remove( &existing->entry );
         HeapFree( GetProcessHeap(), 0, existing );
     }
@@ -1076,7 +1076,10 @@ static BOOL enumerate_mapped_resources( QUEUEDUPDATES *updates,
 
                 resdata = allocate_resource_data( Lang, data->CodePage, p, data->Size, FALSE );
                 if (resdata)
-                    update_add_resource( updates, Type, Name, resdata, FALSE );
+                {
+                    if (!update_add_resource( updates, Type, Name, resdata, FALSE ))
+                        HeapFree( GetProcessHeap(), 0, resdata );
+                }
             }
             res_free_str( Name );
         }




More information about the wine-cvs mailing list