Module: wine Branch: master Commit: 27b18a395b1c4caa0bdb2ec9e0175cccfbe9bf12 URL: http://source.winehq.org/git/wine.git/?a=commit;h=27b18a395b1c4caa0bdb2ec9e0...
Author: Hans Leidekker hans@codeweavers.com Date: Tue May 13 13:41:35 2014 +0200
wbemprox: Use a separate index variable to build the safearray in get_properties.
---
dlls/wbemprox/query.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/dlls/wbemprox/query.c b/dlls/wbemprox/query.c index c97b52b..b3a3eb9 100644 --- a/dlls/wbemprox/query.c +++ b/dlls/wbemprox/query.c @@ -963,12 +963,12 @@ HRESULT get_properties( const struct view *view, LONG flags, SAFEARRAY **props ) { SAFEARRAY *sa; BSTR str; - LONG i; - UINT num_props = count_selected_properties( view ); + UINT i, num_props = count_selected_properties( view ); + LONG j;
if (!(sa = SafeArrayCreateVector( VT_BSTR, 0, num_props ))) return E_OUTOFMEMORY;
- for (i = 0; i < view->table->num_cols; i++) + for (i = 0, j = 0; i < view->table->num_cols; i++) { BOOL is_system;
@@ -980,12 +980,13 @@ HRESULT get_properties( const struct view *view, LONG flags, SAFEARRAY **props ) else if ((flags & WBEM_FLAG_SYSTEM_ONLY) && !is_system) continue;
str = SysAllocString( view->table->columns[i].name ); - if (!str || SafeArrayPutElement( sa, &i, str ) != S_OK) + if (!str || SafeArrayPutElement( sa, &j, str ) != S_OK) { SysFreeString( str ); SafeArrayDestroy( sa ); return E_OUTOFMEMORY; } + j++; } *props = sa; return S_OK;