Commit 5b072fbb authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

msi: Fix several memory leaks after using IEnumSTATSTG_Next.

The pwcsName field of STATSTG must be freed, otherwise the memory will be leaked.
parent 1f563592
...@@ -408,17 +408,22 @@ static UINT add_streams_to_table(MSISTREAMSVIEW *sv) ...@@ -408,17 +408,22 @@ static UINT add_streams_to_table(MSISTREAMSVIEW *sv)
/* table streams are not in the _Streams table */ /* table streams are not in the _Streams table */
if (*stat.pwcsName == 0x4840) if (*stat.pwcsName == 0x4840)
{
CoTaskMemFree(stat.pwcsName);
continue; continue;
}
stream = create_stream(sv, stat.pwcsName, TRUE, NULL); stream = create_stream(sv, stat.pwcsName, TRUE, NULL);
if (!stream) if (!stream)
{ {
count = -1; count = -1;
CoTaskMemFree(stat.pwcsName);
break; break;
} }
IStorage_OpenStream(sv->db->storage, stat.pwcsName, 0, IStorage_OpenStream(sv->db->storage, stat.pwcsName, 0,
STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream->stream); STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stream->stream);
CoTaskMemFree(stat.pwcsName);
if (!add_stream_to_table(sv, stream, count++)) if (!add_stream_to_table(sv, stream, count++))
{ {
......
...@@ -265,6 +265,7 @@ void enum_stream_names( IStorage *stg ) ...@@ -265,6 +265,7 @@ void enum_stream_names( IStorage *stg )
decode_streamname( stat.pwcsName, name ); decode_streamname( stat.pwcsName, name );
TRACE("stream %2d -> %s %s\n", n, TRACE("stream %2d -> %s %s\n", n,
debugstr_w(stat.pwcsName), debugstr_w(name) ); debugstr_w(stat.pwcsName), debugstr_w(name) );
CoTaskMemFree( stat.pwcsName );
n++; n++;
} }
...@@ -2577,6 +2578,7 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg ) ...@@ -2577,6 +2578,7 @@ UINT msi_table_apply_transform( MSIDATABASE *db, IStorage *stg )
break; break;
decode_streamname( stat.pwcsName, name ); decode_streamname( stat.pwcsName, name );
CoTaskMemFree( stat.pwcsName );
if ( name[0] != 0x4840 ) if ( name[0] != 0x4840 )
continue; continue;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment