[PATCH] wbemprox: avoid leaking glob (Coverity)

Marcus Meissner marcus at jet.franken.de
Sat Jun 15 02:28:43 CDT 2013


there were some continues in the loop were glob would be overwritten

 1030111 Resource leak

Ciao, Marcus
---
 dlls/wbemprox/builtin.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index d90165f..6049030 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -1298,6 +1298,7 @@ static enum fill_status fill_directory( struct table *table, const struct expr *
             }
             if ((handle = FindFirstFileW( glob, &data )) != INVALID_HANDLE_VALUE)
             {
+                heap_free(glob);
                 do
                 {
                     if (!resize_table( table, row + 1, sizeof(*rec) ))
@@ -1336,16 +1337,16 @@ static enum fill_status fill_directory( struct table *table, const struct expr *
                 }
                 while (FindNextFileW( handle, &data ));
                 FindClose( handle );
-            }
+            } else
+                heap_free(glob);
+
             if (!peek_dir( dirstack )) break;
-            heap_free( glob );
             heap_free( path );
         }
     }
 
 done:
     free_dirstack( dirstack );
-    heap_free( glob );
     heap_free( path );
 
     TRACE("created %u rows\n", row);
-- 
1.7.10.4




More information about the wine-patches mailing list