Rob Shearman : msi: Fix several memory leaks after using IEnumSTATSTG_Next.
Alexandre Julliard
julliard at winehq.org
Wed Dec 26 10:05:07 CST 2007
Module: wine
Branch: master
Commit: 5b072fbbeced03e5cdd924a6521a96266b58a464
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5b072fbbeced03e5cdd924a6521a96266b58a464
Author: Rob Shearman <rob at codeweavers.com>
Date: Wed Dec 26 11:02:55 2007 +0000
msi: Fix several memory leaks after using IEnumSTATSTG_Next.
The pwcsName field of STATSTG must be freed, otherwise the memory will
be leaked.
---
dlls/msi/streams.c | 5 +++++
dlls/msi/table.c | 2 ++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/dlls/msi/streams.c b/dlls/msi/streams.c
index bb86fd0..9828b7f 100644
--- a/dlls/msi/streams.c
+++ b/dlls/msi/streams.c
@@ -408,17 +408,22 @@ static UINT add_streams_to_table(MSISTREAMSVIEW *sv)
/* table streams are not in the _Streams table */
if (*stat.pwcsName == 0x4840)
+ {
+ CoTaskMemFree(stat.pwcsName);
continue;
+ }
stream = create_stream(sv, stat.pwcsName, TRUE, NULL);
if (!stream)
{
count = -1;
+ CoTaskMemFree(stat.pwcsName);
break;
}
IStorage_OpenStream(sv->db->storage, stat.pwcsName, 0,
STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream->stream);
+ CoTaskMemFree(stat.pwcsName);
if (!add_stream_to_table(sv, stream, count++))
{
diff --git a/dlls/msi/table.c b/dlls/msi/table.c
index 7824521..ca6fa1b 100644
--- a/dlls/msi/table.c
+++ b/dlls/msi/table.c
@@ -265,6 +265,7 @@ void enum_stream_names( IStorage *stg )
decode_streamname( stat.pwcsName, name );
TRACE("stream %2d -> %s %s\n", n,
debugstr_w(stat.pwcsName), debugstr_w(name) );
+ CoTaskMemFree( stat.pwcsName );
n++;
}
@@ -2577,6 +2578,7 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg )
break;
decode_streamname( stat.pwcsName, name );
+ CoTaskMemFree( stat.pwcsName );
if ( name[0] != 0x4840 )
continue;
More information about the wine-cvs
mailing list