diff --git a/client/X11/xf_gfx.c b/client/X11/xf_gfx.c index 2cbd1d4ff..f94551054 100644 --- a/client/X11/xf_gfx.c +++ b/client/X11/xf_gfx.c @@ -555,7 +555,10 @@ int xf_CreateSurface(RdpgfxClientContext* context, RDPGFX_CREATE_SURFACE_PDU* cr surface->data = (BYTE*) _aligned_malloc(size, 16); if (!surface->data) + { + free (surface); return -1; + } ZeroMemory(surface->data, size); @@ -574,7 +577,11 @@ int xf_CreateSurface(RdpgfxClientContext* context, RDPGFX_CREATE_SURFACE_PDU* cr surface->stage = (BYTE*) _aligned_malloc(size, 16); if (!surface->stage) + { + free (surface->data); + free (surface); return -1; + } ZeroMemory(surface->stage, size); @@ -749,7 +756,10 @@ int xf_SurfaceToCache(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_CACHE_PDU* cacheEntry->data = (BYTE*) _aligned_malloc(size, 16); if (!cacheEntry->data) + { + free (cacheEntry); return -1; + } ZeroMemory(cacheEntry->data, size);