[PATCH] webservices: Fixed memory leaks in one error condition (Coverity)

Hans Leidekker hans at codeweavers.com
Mon Mar 7 02:10:27 CST 2016


Hi Marcus,
> diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c
> index 72e75c3..688bc2b 100644
> --- a/dlls/webservices/reader.c
> +++ b/dlls/webservices/reader.c
> @@ -928,7 +928,7 @@ static HRESULT read_attribute( struct reader *reader, WS_XML_ATTRIBUTE **ret )
>      WS_XML_UTF8_TEXT *text;
>      unsigned int len = 0, ch, skip, quote;
>      const unsigned char *start;
> -    WS_XML_STRING *prefix, *localname;
> +    WS_XML_STRING *prefix, *localname = NULL;
>      HRESULT hr = WS_E_INVALID_FORMAT;
>  
>      if (!(attr = heap_alloc_zero( sizeof(*attr) ))) return E_OUTOFMEMORY;
> @@ -948,7 +948,11 @@ static HRESULT read_attribute( struct reader *reader, WS_XML_ATTRIBUTE **ret )
>      if (WsXmlStringEquals( prefix, &xmlns, NULL ) == S_OK)
>      {
>          attr->isXmlNs   = 1;
> -        if (!(attr->prefix = alloc_xml_string( localname->bytes, localname->length ))) goto error;
> +	heap_free (prefix);
> +        if (!(attr->prefix = alloc_xml_string( localname->bytes, localname->length ))) {
> +		heap_free (localname);
> +		goto error;
> +	}
>          attr->localName = localname;
>      }
>      else

Please replace tabs with spaces and use the same formatting as surrounding code. Otherwise
it looks good, thanks.





More information about the wine-devel mailing list