[PATCH] wbemprox: Always free 'new_path'.
Hans Leidekker
hans at codeweavers.com
Mon Nov 18 04:16:48 CST 2019
From: Serge Gautherie <winehq-git_serge_180711 at gautherie.fr>
Signed-off-by: Serge Gautherie <winehq-git_serge_180711 at gautherie.fr>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
---
dlls/wbemprox/builtin.c | 18 ++++++++++++++++--
1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index 96d1e0b850..53d4b169cd 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -2341,7 +2341,13 @@ static enum fill_status fill_datafile( struct table *table, const struct expr *c
goto done;
}
if (!wcscmp( data.cFileName, dotW ) || !wcscmp( data.cFileName, dotdotW )) continue;
- new_path = append_path( path, data.cFileName, &len );
+
+ if (!(new_path = append_path( path, data.cFileName, &len )))
+ {
+ status = FILL_STATUS_FAILED;
+ FindClose( handle );
+ goto done;
+ }
if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
@@ -2354,6 +2360,7 @@ static enum fill_status fill_datafile( struct table *table, const struct expr *c
rec = (struct record_datafile *)(table->data + offset);
rec->name = build_name( root[0], new_path );
rec->version = get_file_version( rec->name );
+ heap_free( new_path );
if (!match_row( table, row, cond, &status ))
{
free_row_values( table, row );
@@ -2465,7 +2472,13 @@ static enum fill_status fill_directory( struct table *table, const struct expr *
!wcscmp( data.cFileName, dotW ) || !wcscmp( data.cFileName, dotdotW ))
continue;
- new_path = append_path( path, data.cFileName, &len );
+ if (!(new_path = append_path( path, data.cFileName, &len )))
+ {
+ FindClose( handle );
+ status = FILL_STATUS_FAILED;
+ goto done;
+ }
+
if (!(push_dir( dirstack, new_path, len )))
{
heap_free( new_path );
@@ -2476,6 +2489,7 @@ static enum fill_status fill_directory( struct table *table, const struct expr *
rec = (struct record_directory *)(table->data + offset);
rec->accessmask = FILE_ALL_ACCESS;
rec->name = build_name( root[0], new_path );
+ heap_free( new_path );
if (!match_row( table, row, cond, &status ))
{
free_row_values( table, row );
--
2.20.1
More information about the wine-devel
mailing list