[01/11] wbemprox: Always use resize_table to allocate memory for table data.

Hans Leidekker hans at codeweavers.com
Fri Jun 14 03:01:33 CDT 2013


---
 dlls/wbemprox/builtin.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index 8878ddc..b9bdacc 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -846,7 +846,7 @@ static enum fill_status fill_compsys( struct table *table, const struct expr *co
     enum fill_status status = FILL_STATUS_UNFILTERED;
     UINT row = 0;
 
-    if (!(table->data = heap_alloc( sizeof(*rec) ))) return FILL_STATUS_FAILED;
+    if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
 
     rec = (struct record_computersystem *)table->data;
     rec->description            = compsys_descriptionW;
@@ -1499,7 +1499,7 @@ static enum fill_status fill_networkadapter( struct table *table, const struct e
         return FILL_STATUS_FAILED;
     }
     for (aa = buffer; aa; aa = aa->Next) count++;
-    if (!(table->data = heap_alloc( sizeof(*rec) * count )))
+    if (!resize_table( table, count, sizeof(*rec) ))
     {
         heap_free( buffer );
         return FILL_STATUS_FAILED;
@@ -1664,7 +1664,7 @@ static enum fill_status fill_processor( struct table *table, const struct expr *
     UINT i, offset = 0, maxclockspeed, num_logical_processors, count = get_processor_count();
     enum fill_status status = FILL_STATUS_UNFILTERED;
 
-    if (!(table->data = heap_alloc( sizeof(*rec) * count ))) return FILL_STATUS_FAILED;
+    if (!resize_table( table, count, sizeof(*rec) )) return FILL_STATUS_FAILED;
 
     get_processor_id( processor_id );
     get_processor_manufacturer( manufacturer );
@@ -1740,7 +1740,7 @@ static enum fill_status fill_os( struct table *table, const struct expr *cond )
     enum fill_status status = FILL_STATUS_UNFILTERED;
     UINT row = 0;
 
-    if (!(table->data = heap_alloc( sizeof(*rec) ))) return FILL_STATUS_FAILED;
+    if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
 
     rec = (struct record_operatingsystem *)table->data;
     rec->caption          = os_captionW;
@@ -1956,7 +1956,8 @@ static enum fill_status fill_videocontroller( struct table *table, const struct
     enum fill_status status = FILL_STATUS_UNFILTERED;
     UINT row = 0;
 
-    if (!(table->data = heap_alloc( sizeof(*rec) ))) return FILL_STATUS_FAILED;
+    if (!resize_table( table, 1, sizeof(*rec) )) return FILL_STATUS_FAILED;
+
     memset (&desc, 0, sizeof(desc));
     hr = CreateDXGIFactory( &IID_IDXGIFactory, (void **)&factory );
     if (FAILED(hr)) goto done;
-- 
1.7.10.4







More information about the wine-patches mailing list