https://bugs.winehq.org/show_bug.cgi?id=54456 --- Comment #1 from Jason Millard <jsm174(a)gmail.com> --- So I think I have a solution for this. I can submit a MR if you think this is correct. When this code is executed: For Each obj In vpDict.Keys : Debug.Print "Key" : Next "stack_pop_deref(ctx, &v)" returns variant_val_t with "owned" set to true. I added an "owned" flag to "safearray_iter", and the "create_safearray_iter" function typedef struct { IEnumVARIANT IEnumVARIANT_iface; LONG ref; SAFEARRAY *sa; BOOL owned; ULONG i, size; } safearray_iter; HRESULT create_safearray_iter(SAFEARRAY *sa, BOOL owned, IEnumVARIANT **ev) When "safearray_iter_IEnumVARIANT_Release" is called, we checked owned and then free the array. if(!ref) { if(This->sa) { SafeArrayUnlock(This->sa); if (This->owned) SafeArrayDestroy(This->sa); } free(This); } I tested this and I know longer have any memory leaks. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.