Dmitry Timoshkov : ole32: If number of VT_VECTOR elements is 0 there is no need to allocate memory.

Alexandre Julliard julliard at winehq.org
Fri Apr 18 11:01:04 CDT 2014


Module: wine
Branch: master
Commit: f9c40c37cdf6b52a25680fdbcade3bd8d9f1dee6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f9c40c37cdf6b52a25680fdbcade3bd8d9f1dee6

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Fri Apr 18 18:10:19 2014 +0900

ole32: If number of VT_VECTOR elements is 0 there is no need to allocate memory.

---

 dlls/ole32/ole2.c              |    2 +-
 dlls/ole32/tests/propvariant.c |    1 -
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c
index 3849bad..98d00de 100644
--- a/dlls/ole32/ole2.c
+++ b/dlls/ole32/ole2.c
@@ -3143,7 +3143,7 @@ HRESULT WINAPI PropVariantCopy(PROPVARIANT *pvarDest,      /* [out] */
                 return E_INVALIDARG;
             }
             len = pvarSrc->u.capropvar.cElems;
-            pvarDest->u.capropvar.pElems = CoTaskMemAlloc(len * elemSize);
+            pvarDest->u.capropvar.pElems = len ? CoTaskMemAlloc(len * elemSize) : NULL;
             if (pvarSrc->vt == (VT_VECTOR | VT_VARIANT))
             {
                 for (i = 0; i < len; i++)
diff --git a/dlls/ole32/tests/propvariant.c b/dlls/ole32/tests/propvariant.c
index 390a4e1..891c425 100644
--- a/dlls/ole32/tests/propvariant.c
+++ b/dlls/ole32/tests/propvariant.c
@@ -263,7 +263,6 @@ static void test_validtypes(void)
         {
             ok(copy.vt == propvar.vt, "expected %d, got %d\n", propvar.vt, copy.vt);
             ok(!U(copy).caub.cElems, "%u: expected 0, got %d\n", i, U(copy).caub.cElems);
-todo_wine
             ok(!U(copy).caub.pElems, "%u: expected NULL, got %p\n", i, U(copy).caub.pElems);
         }
         else




More information about the wine-cvs mailing list