msi: Fix potential NULL pointer dereference in ILockBytes_Release (Coverity)

Nikolay Sivov bunglehead at gmail.com
Sat Jan 24 09:53:12 CST 2009


Potential dereference of uninitialized interface pointer on stream_to_storage
could occur during cleanup.

Changelog:
    - Fix potential NULL pointer dereference in ILockBytes_Release (Coverity)

>From 51ea2b11d4796e96233c74ca53933606b6db51a6 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <bunglehead at gmail.com>
Date: Sat, 24 Jan 2009 18:47:33 +0300
Subject: Fix potential NULL pointer dereference in ILockBytes_Release (Coverity)

---
 dlls/msi/storages.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/msi/storages.c b/dlls/msi/storages.c
index 2e21cb8..302906b 100644
--- a/dlls/msi/storages.c
+++ b/dlls/msi/storages.c
@@ -134,7 +134,7 @@ static UINT STORAGES_get_row( struct tagMSIVIEW *view, UINT row, MSIRECORD **rec
 
 static HRESULT stream_to_storage(IStream *stm, IStorage **stg)
 {
-    ILockBytes *lockbytes;
+    ILockBytes *lockbytes = NULL;
     STATSTG stat;
     LPVOID data;
     HRESULT hr;
@@ -177,7 +177,7 @@ static HRESULT stream_to_storage(IStream *stm, IStorage **stg)
 
 done:
     msi_free(data);
-    ILockBytes_Release(lockbytes);
+    if (lockbytes) ILockBytes_Release(lockbytes);
     return hr;
 }
 
-- 
1.5.6.5






More information about the wine-patches mailing list