Chao Long : ole32: Check for NULL parameter in ReleaseStgMedium().

Alexandre Julliard julliard at winehq.org
Mon Sep 28 14:49:25 CDT 2020


Module: wine
Branch: master
Commit: 3956b5260302926c09f571df79b3431aca0c1479
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3956b5260302926c09f571df79b3431aca0c1479

Author: Chao Long <longchao at uniontech.com>
Date:   Mon Sep 28 09:31:11 2020 +0100

ole32: Check for NULL parameter in ReleaseStgMedium().

libcef can call ReleaseStgMedium( NULL )

Signed-off-by: Chao Long <longchao at uniontech.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/ole32/ole2.c       | 2 ++
 dlls/ole32/tests/ole2.c | 6 ++++++
 2 files changed, 8 insertions(+)

diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c
index 15c4f8234f..4464ba0714 100644
--- a/dlls/ole32/ole2.c
+++ b/dlls/ole32/ole2.c
@@ -2023,6 +2023,8 @@ found:
 void WINAPI ReleaseStgMedium(
   STGMEDIUM* pmedium)
 {
+  if (!pmedium) return;
+
   switch (pmedium->tymed)
   {
     case TYMED_HGLOBAL:
diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c
index cd7eb83923..42e377f8a6 100644
--- a/dlls/ole32/tests/ole2.c
+++ b/dlls/ole32/tests/ole2.c
@@ -4610,6 +4610,11 @@ static void test_OleCreateStaticFromData(void)
     IStorage_Release(storage);
 }
 
+static void test_ReleaseStgMedium( void )
+{
+    ReleaseStgMedium( NULL );
+}
+
 START_TEST(ole2)
 {
     DWORD dwRegister;
@@ -4661,6 +4666,7 @@ START_TEST(ole2)
     test_data_cache_save_data();
     test_data_cache_contents();
     test_OleCreateStaticFromData();
+    test_ReleaseStgMedium();
 
     CoUninitialize();
 }




More information about the wine-cvs mailing list