Commit 3076f5e3 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

webservices: Always create a copy of strings to insert in the dictionary.

parent 0567952c
...@@ -1208,14 +1208,24 @@ static HRESULT CALLBACK dict_cb( void *state, const WS_XML_STRING *str, BOOL *fo ...@@ -1208,14 +1208,24 @@ static HRESULT CALLBACK dict_cb( void *state, const WS_XML_STRING *str, BOOL *fo
{ {
struct dictionary *dict = state; struct dictionary *dict = state;
HRESULT hr = S_OK; HRESULT hr = S_OK;
BYTE *bytes;
int index; int index;
if ((index = find_string( dict, str->bytes, str->length, id )) == -1 || if ((index = find_string( dict, str->bytes, str->length, id )) == -1)
(hr = insert_string( dict, str->bytes, str->length, index, id )) == S_OK) {
*found = TRUE;
return S_OK;
}
if (!(bytes = heap_alloc( str->length ))) return E_OUTOFMEMORY;
memcpy( bytes, str->bytes, str->length );
if ((hr = insert_string( dict, bytes, str->length, index, id )) == S_OK)
{ {
*found = TRUE; *found = TRUE;
return S_OK; return S_OK;
} }
heap_free( bytes );
*found = FALSE; *found = FALSE;
return hr; return hr;
} }
...@@ -1672,6 +1682,7 @@ static HRESULT build_dict( const BYTE *buf, ULONG buflen, struct dictionary *dic ...@@ -1672,6 +1682,7 @@ static HRESULT build_dict( const BYTE *buf, ULONG buflen, struct dictionary *dic
} }
if ((hr = insert_string( dict, bytes, size, index, NULL )) != S_OK) if ((hr = insert_string( dict, bytes, size, index, NULL )) != S_OK)
{ {
heap_free( bytes );
clear_dict( dict ); clear_dict( dict );
return hr; return hr;
} }
......
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