Vincent Povirk : ole32: Add error checking to StorageBaseImpl_CreateStream.

Alexandre Julliard julliard at winehq.org
Mon Feb 15 10:06:11 CST 2010


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Sat Feb 13 12:44:12 2010 -0600

ole32: Add error checking to StorageBaseImpl_CreateStream.

---

 dlls/ole32/storage32.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index 3beff78..a7c12b5 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -834,6 +834,7 @@ static HRESULT WINAPI StorageBaseImpl_CreateStream(
   StgStreamImpl*    newStream;
   DirEntry          currentEntry, newStreamEntry;
   DirRef            currentEntryRef, newStreamEntryRef;
+  HRESULT hr;
 
   TRACE("(%p, %s, %x, %d, %d, %p)\n",
 	iface, debugstr_w(pwcsName), grfMode,
@@ -933,14 +934,22 @@ static HRESULT WINAPI StorageBaseImpl_CreateStream(
   /*
    * Create an entry with the new data
    */
-  StorageBaseImpl_CreateDirEntry(This, &newStreamEntry, &newStreamEntryRef);
+  hr = StorageBaseImpl_CreateDirEntry(This, &newStreamEntry, &newStreamEntryRef);
+  if (FAILED(hr))
+    return hr;
+
   /*
    * Insert the new entry in the parent storage's tree.
    */
-  insertIntoTree(
+  hr = insertIntoTree(
     This,
     This->storageDirEntry,
     newStreamEntryRef);
+  if (FAILED(hr))
+  {
+    StorageBaseImpl_DestroyDirEntry(This, newStreamEntryRef);
+    return hr;
+  }
 
   /*
    * Open the stream to return it.




More information about the wine-cvs mailing list