Vincent Povirk : ole32: Use a temporary variable in TransactedSnapshotImpl_EnsureReadEntry.
Alexandre Julliard
julliard at winehq.org
Thu May 13 13:15:01 CDT 2010
Module: wine
Branch: master
Commit: 57ddceea340da5512a64245792434f760989cb06
URL: http://source.winehq.org/git/wine.git/?a=commit;h=57ddceea340da5512a64245792434f760989cb06
Author: Vincent Povirk <vincent at codeweavers.com>
Date: Wed May 12 14:08:55 2010 -0500
ole32: Use a temporary variable in TransactedSnapshotImpl_EnsureReadEntry.
CreateStubEntry can change the value of This->entries, in which case the
assignment can go to the wrong place. So instead, assign to a temporary
variable, and copy the data back after all CreateStubEntry calls are finished.
---
dlls/ole32/storage32.c | 27 ++++++++++++++-------------
1 files changed, 14 insertions(+), 13 deletions(-)
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index d136837..ce4e885 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -4160,42 +4160,43 @@ static HRESULT TransactedSnapshotImpl_EnsureReadEntry(
TransactedSnapshotImpl *This, DirRef entry)
{
HRESULT hr=S_OK;
+ DirEntry data;
if (!This->entries[entry].read)
{
hr = StorageBaseImpl_ReadDirEntry(This->transactedParent,
This->entries[entry].transactedParentEntry,
- &This->entries[entry].data);
+ &data);
- if (SUCCEEDED(hr) && This->entries[entry].data.leftChild != DIRENTRY_NULL)
+ if (SUCCEEDED(hr) && data.leftChild != DIRENTRY_NULL)
{
- This->entries[entry].data.leftChild =
- TransactedSnapshotImpl_CreateStubEntry(This, This->entries[entry].data.leftChild);
+ data.leftChild = TransactedSnapshotImpl_CreateStubEntry(This, data.leftChild);
- if (This->entries[entry].data.leftChild == DIRENTRY_NULL)
+ if (data.leftChild == DIRENTRY_NULL)
hr = E_OUTOFMEMORY;
}
- if (SUCCEEDED(hr) && This->entries[entry].data.rightChild != DIRENTRY_NULL)
+ if (SUCCEEDED(hr) && data.rightChild != DIRENTRY_NULL)
{
- This->entries[entry].data.rightChild =
- TransactedSnapshotImpl_CreateStubEntry(This, This->entries[entry].data.rightChild);
+ data.rightChild = TransactedSnapshotImpl_CreateStubEntry(This, data.rightChild);
- if (This->entries[entry].data.rightChild == DIRENTRY_NULL)
+ if (data.rightChild == DIRENTRY_NULL)
hr = E_OUTOFMEMORY;
}
- if (SUCCEEDED(hr) && This->entries[entry].data.dirRootEntry != DIRENTRY_NULL)
+ if (SUCCEEDED(hr) && data.dirRootEntry != DIRENTRY_NULL)
{
- This->entries[entry].data.dirRootEntry =
- TransactedSnapshotImpl_CreateStubEntry(This, This->entries[entry].data.dirRootEntry);
+ data.dirRootEntry = TransactedSnapshotImpl_CreateStubEntry(This, data.dirRootEntry);
- if (This->entries[entry].data.dirRootEntry == DIRENTRY_NULL)
+ if (data.dirRootEntry == DIRENTRY_NULL)
hr = E_OUTOFMEMORY;
}
if (SUCCEEDED(hr))
+ {
+ memcpy(&This->entries[entry].data, &data, sizeof(DirEntry));
This->entries[entry].read = 1;
+ }
}
return hr;
More information about the wine-cvs
mailing list