[PATCH] wbemprox: fixed leaks in fill_datafile (Coverity)

Marcus Meissner marcus at jet.franken.de
Mon Mar 24 02:51:04 CDT 2014


i sent this previously for fill_directory, same for fill_datafile:

1030111 Resource leak
1030110 Resource leak
1030109 Resource leak
---
 dlls/wbemprox/builtin.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index 66f2882..9fda507 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -1270,11 +1270,13 @@ static enum fill_status fill_datafile( struct table *table, const struct expr *c
     DWORD drives = GetLogicalDrives();
     WIN32_FIND_DATAW data;
     HANDLE handle;
-    struct dirstack *dirstack = alloc_dirstack(2);
+    struct dirstack *dirstack;
     enum fill_status status = FILL_STATUS_UNFILTERED;
 
     if (!resize_table( table, 8, sizeof(*rec) )) return FILL_STATUS_FAILED;
 
+    dirstack = alloc_dirstack(2);
+
     for (i = 0; i < sizeof(drives); i++)
     {
         if (!(drives & (1 << i))) continue;
@@ -1300,6 +1302,7 @@ static enum fill_status fill_datafile( struct table *table, const struct expr *c
                     if (!resize_table( table, row + 1, sizeof(*rec) ))
                     {
                         status = FILL_STATUS_FAILED;
+                        FindClose( handle );
                         goto done;
                     }
                     if (!strcmpW( data.cFileName, dotW ) || !strcmpW( data.cFileName, dotdotW )) continue;
@@ -1309,6 +1312,7 @@ static enum fill_status fill_datafile( struct table *table, const struct expr *c
                     {
                         if (push_dir( dirstack, new_path, len )) continue;
                         heap_free( new_path );
+                        FindClose( handle );
                         status = FILL_STATUS_FAILED;
                         goto done;
                     }
-- 
1.8.4.5




More information about the wine-patches mailing list