s = cliprdr_packet_new(CB_FORMAT_LIST, 0, stream_get_size(body));
stream_write(s, stream_get_head(body), stream_get_size(body));
+ stream_free(body);
}
cliprdr_packet_send(cliprdr, s);
static void cliprdr_process_terminate(rdpSvcPlugin* plugin)
{
+ cliprdrPlugin* cliprdr_plugin = (cliprdrPlugin*) plugin;
+
+ if (cliprdr_plugin->uniconv != NULL)
+ freerdp_uniconv_free(cliprdr_plugin->uniconv);
+
xfree(plugin);
}
xf_kbd_init(xfi);
- xfi->clrconv = xnew(CLRCONV);
- xfi->clrconv->alpha = true;
- xfi->clrconv->invert = false;
- xfi->clrconv->rgb555 = false;
- xfi->clrconv->palette = xnew(rdpPalette);
+ xfi->clrconv = freerdp_clrconv_new(CLRCONV_ALPHA);
instance->context->cache = cache_new(instance->settings);
xfi->srcBpp = instance->settings->color_depth;
xf_gdi_register_update_callbacks(instance->update);
- xfi->hdc = gdi_GetDC();
- xfi->hdc->bitsPerPixel = xfi->bpp;
- xfi->hdc->bytesPerPixel = xfi->bpp / 8;
-
- xfi->hdc->alpha = xfi->clrconv->alpha;
- xfi->hdc->invert = xfi->clrconv->invert;
- xfi->hdc->rgb555 = xfi->clrconv->rgb555;
-
- xfi->hdc->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND));
- xfi->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);
- xfi->hdc->hwnd->invalid->null = 1;
-
- xfi->hdc->hwnd->count = 32;
- xfi->hdc->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * xfi->hdc->hwnd->count);
- xfi->hdc->hwnd->ninvalid = 0;
+ xfi->hdc = gdi_CreateDC(xfi->clrconv, xfi->bpp);
xfi->primary_buffer = (uint8*) xzalloc(xfi->width * xfi->height * xfi->bpp);
rfx_context_free(xfi->rfx_context);
xfi->rfx_context = NULL;
}
-
- xfree(xfi->clrconv);
+
+ freerdp_clrconv_free(xfi->clrconv);
+ gdi_DeleteDC(xfi->hdc);
xf_tsmf_uninit(xfi);
xf_cliprdr_uninit(xfi);
void xf_free(xfInfo* xfi)
{
xf_window_free(xfi);
+
+ if (xfi->bmp_codec_none != NULL)
+ xfree(xfi->bmp_codec_none);
+
XCloseDisplay(xfi->display);
xfree(xfi);
}
FREERDP_API uint32 freerdp_color_convert_var_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
FREERDP_API uint32 freerdp_color_convert_var_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
+FREERDP_API HCLRCONV freerdp_clrconv_new(uint32 flags);
+FREERDP_API void freerdp_clrconv_free(HCLRCONV clrconv);
+
#ifdef __cplusplus
}
#endif
#include <freerdp/gdi/gdi.h>
FREERDP_API HGDI_DC gdi_GetDC();
+FREERDP_API HGDI_DC gdi_CreateDC(HCLRCONV clrconv, int bpp);
FREERDP_API HGDI_DC gdi_CreateCompatibleDC(HGDI_DC hdc);
FREERDP_API HGDIOBJECT gdi_SelectObject(HGDI_DC hdc, HGDIOBJECT hgdiobject);
FREERDP_API int gdi_DeleteObject(HGDIOBJECT hgdiobject);
}
if (bitmap_cache->bitmap != NULL)
- bitmap_cache->bitmap->Free(bitmap_cache->context, bitmap_cache->bitmap);
+ Bitmap_Free(bitmap_cache->context, bitmap_cache->bitmap);
xfree(bitmap_cache->cells);
xfree(bitmap_cache);
void brush_cache_free(rdpBrushCache* brush)
{
+ int i;
+
if (brush != NULL)
{
- xfree(brush->entries);
- xfree(brush->monoEntries);
+ if (brush->entries != NULL)
+ {
+ for (i = 0; i < brush->maxEntries; i++)
+ {
+ if (brush->entries[i].entry != NULL)
+ xfree(brush->entries[i].entry);
+ }
+
+ xfree(brush->entries);
+ }
+
+ if (brush->monoEntries != NULL)
+ {
+ for (i = 0; i < brush->maxMonoEntries; i++)
+ {
+ if (brush->monoEntries[i].entry != NULL)
+ xfree(brush->monoEntries[i].entry);
+ }
+
+ xfree(brush->monoEntries);
+ }
+
xfree(brush);
}
}
Glyph_New(context, glyph);
glyph_cache_put(cache->glyph, cache_glyph->cacheId, glyph_data->cacheIndex, glyph);
+
+ cache_glyph->glyphData[i] = NULL;
+ xfree(glyph_data);
}
}
Glyph_New(context, glyph);
glyph_cache_put(cache->glyph, cache_glyph_v2->cacheId, glyph_data->cacheIndex, glyph);
+
+ cache_glyph_v2->glyphData[i] = NULL;
+ xfree(glyph_data);
}
}
rdpGlyph* glyph;
glyph = glyph_cache->glyphCache[i].entries[j];
+
if (glyph != NULL)
{
Glyph_Free(glyph_cache->context, glyph);
pointer = pointer_cache->entries[i];
if (pointer != NULL)
- {
- pointer->Free(pointer_cache->update->context, pointer);
-
- if (pointer->xorMaskData != NULL)
- xfree(pointer->xorMaskData);
-
- if (pointer->andMaskData != NULL)
- xfree(pointer->andMaskData);
-
- xfree(pointer);
- }
+ Pointer_Free(pointer_cache->update->context, pointer);
}
xfree(pointer_cache->entries);
}
}
}
+
+HCLRCONV freerdp_clrconv_new(uint32 flags)
+{
+ HCLRCONV clrconv = xnew(CLRCONV);
+
+ clrconv->alpha = (flags & CLRCONV_ALPHA) ? true : false;
+ clrconv->invert = (flags & CLRCONV_INVERT) ? true : false;
+ clrconv->rgb555 = (flags & CLRCONV_RGB555) ? true : false;
+ clrconv->palette = xnew(rdpPalette);
+
+ return clrconv;
+}
+
+void freerdp_clrconv_free(HCLRCONV clrconv)
+{
+ if (clrconv != NULL)
+ {
+ if (clrconv->palette != NULL)
+ xfree(clrconv->palette);
+
+ xfree(clrconv);
+ }
+}
DEBUG_CERTIFICATE("License Server Certificate");
certificate_read_x509_certificate(&certificate->x509_cert_chain->array[i], &cert_info);
DEBUG_LICENSE("modulus length:%d", cert_info.modulus.length);
+ freerdp_blob_free(&cert_info.modulus);
}
else if (numCertBlobs - i == 1)
{
if (certificate != NULL)
{
certificate_free_x509_certificate_chain(certificate->x509_cert_chain);
+
+ if (certificate->cert_info.modulus.data != NULL)
+ freerdp_blob_free(&(certificate->cert_info.modulus));
+
xfree(certificate);
}
}
if (redirection->flags & LB_TARGET_NET_ADDRESS)
{
xfree(settings->hostname);
- settings->hostname = redirection->targetNetAddress.ascii;
+ settings->hostname = xstrdup(redirection->targetNetAddress.ascii);
}
else if (redirection->flags & LB_TARGET_FQDN)
{
xfree(settings->hostname);
- settings->hostname = redirection->targetFQDN.ascii;
+ settings->hostname = xstrdup(redirection->targetFQDN.ascii);
}
else if (redirection->flags & LB_TARGET_NETBIOS_NAME)
{
xfree(settings->hostname);
- settings->hostname = redirection->targetNetBiosName.ascii;
+ settings->hostname = xstrdup(redirection->targetNetBiosName.ascii);
}
}
if (redirection->flags & LB_USERNAME)
{
xfree(settings->username);
- settings->username = redirection->username.ascii;
+ settings->username = xstrdup(redirection->username.ascii);
}
if (redirection->flags & LB_DOMAIN)
{
xfree(settings->domain);
- settings->domain = redirection->domain.ascii;
+ settings->domain = xstrdup(redirection->domain.ascii);
}
if (redirection->flags & LB_PASSWORD)
credssp->negoToken.length = stream_get_length(s);
credssp_encrypt_public_key(credssp, &credssp->pubKeyAuth);
credssp_send(credssp, &credssp->negoToken, NULL, &credssp->pubKeyAuth);
+ freerdp_blob_free(&credssp->pubKeyAuth);
/* Encrypted Public Key +1 */
if (credssp_recv(credssp, &credssp->negoToken, NULL, &credssp->pubKeyAuth) < 0)
credssp_encode_ts_credentials(credssp);
credssp_encrypt_ts_credentials(credssp, &credssp->authInfo);
credssp_send(credssp, NULL, &credssp->authInfo, NULL);
+ freerdp_blob_free(&credssp->authInfo);
xfree(s);
}
transport_write(credssp->transport, s);
+ stream_free(s);
}
/**
void freerdp_context_free(freerdp* instance)
{
IFCALL(instance->ContextFree, instance, instance->context);
+
+ rdp_free(instance->context->rdp);
+ graphics_free(instance->context->graphics);
+ xfree(instance->context);
}
uint32 freerdp_error_info(freerdp* instance)
{
if (freerdp)
{
- rdp_free(freerdp->context->rdp);
+ freerdp_context_free(freerdp);
xfree(freerdp);
}
}
void Pointer_Free(rdpContext* context, rdpPointer* pointer)
{
+ if (pointer != NULL)
+ {
+ pointer->Free(context, pointer);
+
+ if (pointer->xorMaskData)
+ xfree(pointer->xorMaskData);
+ if (pointer->andMaskData)
+ xfree(pointer->andMaskData);
+
+ xfree(pointer);
+ }
}
/* static method */
{
xfree(graphics->Bitmap_Prototype);
xfree(graphics->Pointer_Prototype);
+ xfree(graphics->Glyph_Prototype);
xfree(graphics);
}
}
buffer = (uint8*) xmalloc(HWID_LENGTH);
rc4 = crypto_rc4_init(license->licensing_encryption_key, LICENSING_ENCRYPTION_KEY_LENGTH);
crypto_rc4(rc4, HWID_LENGTH, license->hwid, buffer);
+ crypto_rc4_free(rc4);
#ifdef WITH_DEBUG_LICENSE
printf("Licensing Encryption Key:\n");
{
struct rdp_mppc* ptr;
- ptr = (struct rdp_mppc *) xmalloc(sizeof (struct rdp_mppc));
+ ptr = (struct rdp_mppc*) xmalloc(sizeof(struct rdp_mppc));
+
if (!ptr)
{
printf("mppc_new(): system out of memory\n");
return NULL;
}
- ptr->history_buf = (uint8 *) xmalloc(RDP6_HISTORY_BUF_SIZE);
- ptr->offset_cache = (uint16 *) xzalloc(RDP6_OFFSET_CACHE_SIZE);
+ ptr->history_buf = (uint8*) xmalloc(RDP6_HISTORY_BUF_SIZE);
+ ptr->offset_cache = (uint16*) xzalloc(RDP6_OFFSET_CACHE_SIZE);
+
if (!ptr->history_buf)
{
printf("mppc_new(): system out of memory\n");
ptr->history_ptr = ptr->history_buf;
ptr->history_buf_end = ptr->history_buf + RDP6_HISTORY_BUF_SIZE - 1;
+
return ptr;
}
rdp->mppc->history_buf = NULL;
rdp->mppc->history_ptr = NULL;
}
+
+ if (rdp->mppc->offset_cache)
+ {
+ xfree(rdp->mppc->offset_cache);
+ }
+
xfree(rdp->mppc);
}
xfree(settings->glyphCache);
xfree(settings->fragCache);
key_free(settings->server_key);
+ xfree(settings->config_path);
+ xfree(settings->current_path);
+ xfree(settings->development_path);
xfree(settings);
}
}
#include <stdlib.h>
#include <freerdp/freerdp.h>
#include <freerdp/gdi/gdi.h>
+#include <freerdp/codec/color.h>
#include <freerdp/gdi/region.h>
}
/**
+ * Create a device context.\n
+ * @msdn{dd144871}
+ * @return new device context
+ */
+
+HGDI_DC gdi_CreateDC(HCLRCONV clrconv, int bpp)
+{
+ HGDI_DC hDC = (HGDI_DC) malloc(sizeof(GDI_DC));
+
+ hDC->drawMode = GDI_R2_BLACK;
+ hDC->clip = gdi_CreateRectRgn(0, 0, 0, 0);
+ hDC->clip->null = 1;
+ hDC->hwnd = NULL;
+
+ hDC->bitsPerPixel = bpp;
+ hDC->bytesPerPixel = bpp / 8;
+
+ hDC->alpha = clrconv->alpha;
+ hDC->invert = clrconv->invert;
+ hDC->rgb555 = clrconv->rgb555;
+
+ hDC->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND));
+ hDC->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);
+ hDC->hwnd->invalid->null = 1;
+
+ hDC->hwnd->count = 32;
+ hDC->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * hDC->hwnd->count);
+ hDC->hwnd->ninvalid = 0;
+
+ return hDC;
+}
+
+/**
* Create a new device context compatible with the given device context.\n
* @msdn{dd183489}
* @param hdc device context
{
if (hdc->hwnd)
{
- free(hdc->hwnd->cinvalid);
- free(hdc->hwnd->invalid);
+ if (hdc->hwnd->cinvalid != NULL)
+ free(hdc->hwnd->cinvalid);
+
+ if (hdc->hwnd->invalid != NULL)
+ free(hdc->hwnd->invalid);
+
free(hdc->hwnd);
}