From 24f3f0c4a6bab180a8de4bbda3968be6451e5883 Mon Sep 17 00:00:00 2001 From: Armin Novak Date: Sun, 16 Nov 2014 23:30:31 +0100 Subject: [PATCH] Fixed memory leaks. --- channels/rdpgfx/client/rdpgfx_main.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/channels/rdpgfx/client/rdpgfx_main.c b/channels/rdpgfx/client/rdpgfx_main.c index 43809eaf8..b5a6b2623 100644 --- a/channels/rdpgfx/client/rdpgfx_main.c +++ b/channels/rdpgfx/client/rdpgfx_main.c @@ -206,7 +206,10 @@ int rdpgfx_recv_reset_graphics_pdu(RDPGFX_CHANNEL_CALLBACK* callback, wStream* s pad = 340 - (RDPGFX_HEADER_SIZE + 12 + (pdu.monitorCount * 20)); if (Stream_GetRemainingLength(s) < (size_t) pad) + { + free(pdu.monitorDefArray); return -1; + } Stream_Seek(s, pad); /* pad (total size is 340 bytes) */ @@ -1079,7 +1082,10 @@ int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints) gfx->SurfaceTable = HashTable_New(TRUE); if (!gfx->SurfaceTable) + { + free (gfx); return -1; + } gfx->ThinClient = gfx->settings->GfxThinClient; gfx->SmallCache = gfx->settings->GfxSmallCache; @@ -1098,7 +1104,10 @@ int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints) context = (RdpgfxClientContext*) calloc(1, sizeof(RdpgfxClientContext)); if (!context) + { + free (gfx); return -1; + } context->handle = (void*) gfx; @@ -1112,7 +1121,11 @@ int DVCPluginEntry(IDRDYNVC_ENTRY_POINTS* pEntryPoints) gfx->zgfx = zgfx_context_new(FALSE); if (!gfx->zgfx) + { + free (gfx); + free (context); return -1; + } status = pEntryPoints->RegisterPlugin(pEntryPoints, "rdpgfx", (IWTSPlugin*) gfx); }