[PATCH] webservices: free the potentially allocated pointer (Coverity)
Marcus Meissner
marcus at jet.franken.de
Mon Dec 19 02:30:14 CST 2016
On Mon, Dec 19, 2016 at 09:14:16AM +0100, Hans Leidekker wrote:
> On Sat, 2016-12-17 at 12:48 +0100, Marcus Meissner wrote:
> > 1374356 Resource leak
> >
> > Signed-off-by: Marcus Meissner <marcus at jet.franken.de>
> > ---
> > dlls/webservices/reader.c | 26 ++++++++++++++++++++++----
> > 1 file changed, 22 insertions(+), 4 deletions(-)
> >
> > diff --git a/dlls/webservices/reader.c b/dlls/webservices/reader.c
> > index d67c47a701..219683b2af 100644
> > --- a/dlls/webservices/reader.c
> > +++ b/dlls/webservices/reader.c
> > @@ -4701,15 +4701,33 @@ static ULONG get_field_size( const WS_FIELD_DESCRIPTION *desc )
> >
> > static HRESULT read_param( struct reader *reader, const WS_FIELD_DESCRIPTION *desc, WS_HEAP *heap, void *ret )
> > {
> > - if (!ret && !(ret = ws_alloc_zero( heap, get_field_size(desc) ))) return WS_E_QUOTA_EXCEEDED;
> > - return read_type_struct_field( reader, desc, heap, ret, 0 );
> > + HRESULT hr;
> > + VOID *xret = NULL;
> > +
> > + if (!ret)
> > + {
> > + if (!(xret = ws_alloc_zero( heap, get_field_size(desc) ))) return WS_E_QUOTA_EXCEEDED;
> > + ret = xret;
> > + }
> > + hr = read_type_struct_field( reader, desc, heap, ret, 0 );
> > + ws_free( heap, xret);
> > + return hr;
> > }
>
> It's not a leak. The memory is allocated on the heap passed to this function and it will
> be released when the heap is destroyed. I guess Coverity doesn't see that.
Yes, it does not think in Heaps. Will mark the issue as invalid.
Ciao, Marcus
More information about the wine-devel
mailing list