Fix memory leaks.

This commit is contained in:
Michael Jumper 2012-03-22 10:27:57 -07:00
parent b41f925fed
commit b1cb271351
2 changed files with 21 additions and 2 deletions

View File

@ -121,6 +121,7 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) {
bitmap->Decompress = guac_rdp_bitmap_decompress;
bitmap->SetSurface = guac_rdp_bitmap_setsurface;
graphics_register_bitmap(context->graphics, bitmap);
xfree(bitmap);
/* Set up glyph handling */
glyph = xnew(rdpGlyph);
@ -131,6 +132,7 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) {
glyph->BeginDraw = guac_rdp_glyph_begindraw;
glyph->EndDraw = guac_rdp_glyph_enddraw;
graphics_register_glyph(context->graphics, glyph);
xfree(glyph);
/* Set up pointer handling */
pointer = xnew(rdpPointer);
@ -139,6 +141,7 @@ boolean rdp_freerdp_pre_connect(freerdp* instance) {
pointer->Free = guac_rdp_pointer_free;
pointer->Set = guac_rdp_pointer_set;
graphics_register_pointer(context->graphics, pointer);
xfree(pointer);
/* Set up GDI */
instance->update->Palette = guac_rdp_gdi_palette_update;

View File

@ -45,6 +45,8 @@
#include <freerdp/freerdp.h>
#include <freerdp/channels/channels.h>
#include <freerdp/input.h>
#include <freerdp/codec/color.h>
#include <freerdp/cache/cache.h>
#include <guacamole/socket.h>
#include <guacamole/protocol.h>
@ -58,11 +60,25 @@ void __guac_rdp_update_keysyms(guac_client* client, const int* keysym_string, in
int __guac_rdp_send_keysym(guac_client* client, int keysym, int pressed);
void __guac_rdp_send_altcode(guac_client* client, int altcode);
int rdp_guac_client_free_handler(guac_client* client) {
/* STUB */
rdp_guac_client_data* guac_client_data =
(rdp_guac_client_data*) client->data;
/* FIXME: Clean up RDP client + disconnect */
freerdp* rdp_inst = guac_client_data->rdp_inst;
rdpChannels* channels = rdp_inst->context->channels;
/* Clean up RDP client */
freerdp_channels_close(channels, rdp_inst);
freerdp_channels_free(channels);
freerdp_disconnect(rdp_inst);
freerdp_clrconv_free(((rdp_freerdp_context*) rdp_inst->context)->clrconv);
cache_free(rdp_inst->context->cache);
freerdp_free(rdp_inst);
/* Free client data */
free(guac_client_data);
return 0;