From 74ed392f85834555bc1f5fb235ccb54abaffbb38 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Sat, 11 Feb 2017 17:40:11 -0600
Subject: [PATCH] storage.dll16: Set OpenStorage/OpenStream output to NULL on
 failure.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
---
 dlls/storage.dll16/storage.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/dlls/storage.dll16/storage.c b/dlls/storage.dll16/storage.c
index 2ce35713be3..cac616cc2ec 100644
--- a/dlls/storage.dll16/storage.c
+++ b/dlls/storage.dll16/storage.c
@@ -1859,11 +1859,13 @@ HRESULT CDECL IStorage16_fnOpenStorage(IStorage16 *iface, LPCOLESTR16 pwcsName,
 	newpps = STORAGE_look_for_named_pps(&lpstg->str,This->stde.pps_dir,name);
 	if (newpps==-1) {
 		IStorage16_fnRelease(&lpstg->IStorage16_iface);
+		*ppstg = NULL;
 		return E_FAIL;
 	}
 
 	if (1!=STORAGE_get_pps_entry(&lpstg->str,newpps,&(lpstg->stde))) {
 		IStorage16_fnRelease(&lpstg->IStorage16_iface);
+		*ppstg = NULL;
 		return E_FAIL;
 	}
 	lpstg->ppsent		= newpps;
@@ -1899,11 +1901,13 @@ HRESULT CDECL IStorage16_fnOpenStream(IStorage16 *iface, LPCOLESTR16 pwcsName, v
 	newpps = STORAGE_look_for_named_pps(&lpstr->str,This->stde.pps_dir,name);
 	if (newpps==-1) {
 		IStream16_fnRelease(&lpstr->IStream16_iface);
+		*ppstm = NULL;
 		return E_FAIL;
 	}
 
 	if (1!=STORAGE_get_pps_entry(&lpstr->str,newpps,&(lpstr->stde))) {
 		IStream16_fnRelease(&lpstr->IStream16_iface);
+		*ppstm = NULL;
 		return E_FAIL;
 	}
 	lpstr->offset.u.LowPart		= 0;