Eric Pouech : dbghelp: Fix bug in managing COFF files array.

Alexandre Julliard julliard at winehq.org
Wed Mar 9 11:12:50 CST 2011


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

Author: Eric Pouech <eric.pouech at orange.fr>
Date:   Tue Mar  8 21:31:52 2011 +0100

dbghelp: Fix bug in managing COFF files array.

---

 dlls/dbghelp/coff.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/dlls/dbghelp/coff.c b/dlls/dbghelp/coff.c
index b0a085c..17ba7be 100644
--- a/dlls/dbghelp/coff.c
+++ b/dlls/dbghelp/coff.c
@@ -138,12 +138,18 @@ static void coff_add_symbol(struct CoffFile* coff_file, struct symt* sym)
 {
     if (coff_file->neps + 1 >= coff_file->neps_alloc)
     {
-        coff_file->neps_alloc *= 2;
-        coff_file->entries = (coff_file->entries) ?
-            HeapReAlloc(GetProcessHeap(), 0, coff_file->entries,
-                        coff_file->neps_alloc * sizeof(struct symt*)) :
-            HeapAlloc(GetProcessHeap(), 0, 
-                      coff_file->neps_alloc * sizeof(struct symt*));
+        if (coff_file->entries)
+        {
+            coff_file->neps_alloc *= 2;
+            coff_file->entries = HeapReAlloc(GetProcessHeap(), 0, coff_file->entries,
+                                             coff_file->neps_alloc * sizeof(struct symt*));
+        }
+        else
+        {
+            coff_file->neps_alloc = 32;
+            coff_file->entries = HeapAlloc(GetProcessHeap(), 0,
+                                           coff_file->neps_alloc * sizeof(struct symt*));
+        }
     }
     coff_file->entries[coff_file->neps++] = sym;
 }




More information about the wine-cvs mailing list