libfreerdp-utils: get rid of xmalloc, xrealloc and xfree

This commit is contained in:
Marc-André Moreau 2012-10-08 23:21:26 -04:00
parent e60a092d81
commit 9909a12af5
135 changed files with 802 additions and 852 deletions

View File

@ -217,8 +217,8 @@ static void* audin_alsa_thread_func(void* arg)
} }
} while (0); } while (0);
xfree(buffer); free(buffer);
xfree(alsa->buffer); free(alsa->buffer);
alsa->buffer = NULL; alsa->buffer = NULL;
if (capture_handle) if (capture_handle)
snd_pcm_close(capture_handle); snd_pcm_close(capture_handle);
@ -236,7 +236,7 @@ static void audin_alsa_free(IAudinDevice* device)
freerdp_thread_free(alsa->thread); freerdp_thread_free(alsa->thread);
freerdp_dsp_context_free(alsa->dsp_context); freerdp_dsp_context_free(alsa->dsp_context);
xfree(alsa); free(alsa);
} }
static boolean audin_alsa_format_supported(IAudinDevice* device, audinFormat* format) static boolean audin_alsa_format_supported(IAudinDevice* device, audinFormat* format)

View File

@ -358,8 +358,8 @@ static int audin_on_close(IWTSVirtualChannelCallback* pChannelCallback)
if (audin->device) if (audin->device)
IFCALL(audin->device->Close, audin->device); IFCALL(audin->device->Close, audin->device);
xfree(callback->formats); free(callback->formats);
xfree(callback); free(callback);
return 0; return 0;
} }
@ -415,8 +415,8 @@ static int audin_plugin_terminated(IWTSPlugin* pPlugin)
audin->device = NULL; audin->device = NULL;
} }
xfree(audin->listener_callback); free(audin->listener_callback);
xfree(audin); free(audin);
return 0; return 0;
} }
@ -452,7 +452,7 @@ static boolean audin_load_device_plugin(IWTSPlugin* pPlugin, const char* name, R
strcpy(fullname, "audin_"); strcpy(fullname, "audin_");
strcat(fullname, name); strcat(fullname, name);
entry = (PFREERDP_AUDIN_DEVICE_ENTRY) freerdp_load_plugin(fullname, AUDIN_DEVICE_EXPORT_FUNC_NAME); entry = (PFREERDP_AUDIN_DEVICE_ENTRY) freerdp_load_plugin(fullname, AUDIN_DEVICE_EXPORT_FUNC_NAME);
xfree(fullname); free(fullname);
} }
if (entry == NULL) if (entry == NULL)

View File

@ -152,7 +152,7 @@ static void audin_pulse_free(IAudinDevice* device)
pulse->mainloop = NULL; pulse->mainloop = NULL;
} }
freerdp_dsp_context_free(pulse->dsp_context); freerdp_dsp_context_free(pulse->dsp_context);
xfree(pulse); free(pulse);
} }
static boolean audin_pulse_format_supported(IAudinDevice* device, audinFormat* format) static boolean audin_pulse_format_supported(IAudinDevice* device, audinFormat* format)
@ -350,7 +350,7 @@ static void audin_pulse_close(IAudinDevice* device)
pulse->user_data = NULL; pulse->user_data = NULL;
if (pulse->buffer) if (pulse->buffer)
{ {
xfree(pulse->buffer); free(pulse->buffer);
pulse->buffer = NULL; pulse->buffer = NULL;
pulse->buffer_frames = 0; pulse->buffer_frames = 0;
} }

View File

@ -139,7 +139,7 @@ static boolean audin_server_recv_formats(audin_server* audin, STREAM* s, uint32
{ {
if (length < 18) if (length < 18)
{ {
xfree(audin->context.client_formats); free(audin->context.client_formats);
audin->context.client_formats = NULL; audin->context.client_formats = NULL;
return false; return false;
} }
@ -431,6 +431,6 @@ void audin_server_context_free(audin_server_context* context)
if (audin->dsp_context) if (audin->dsp_context)
freerdp_dsp_context_free(audin->dsp_context); freerdp_dsp_context_free(audin->dsp_context);
if (audin->context.client_formats) if (audin->context.client_formats)
xfree(audin->context.client_formats); free(audin->context.client_formats);
xfree(audin); free(audin);
} }

View File

@ -127,7 +127,7 @@ void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint3
ascii = (flags & CB_ASCII_NAMES) ? true : false; ascii = (flags & CB_ASCII_NAMES) ? true : false;
cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) xmalloc(sizeof(CLIPRDR_FORMAT_NAME) * num_formats); cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) malloc(sizeof(CLIPRDR_FORMAT_NAME) * num_formats);
cliprdr->num_format_names = num_formats; cliprdr->num_format_names = num_formats;
for (i = 0; i < num_formats; i++) for (i = 0; i < num_formats; i++)
@ -159,7 +159,7 @@ void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint32
stream_get_mark(s, end_mark); stream_get_mark(s, end_mark);
end_mark += length; end_mark += length;
cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) xmalloc(sizeof(CLIPRDR_FORMAT_NAME) * allocated_formats); cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) malloc(sizeof(CLIPRDR_FORMAT_NAME) * allocated_formats);
cliprdr->num_format_names = 0; cliprdr->num_format_names = 0;
while (stream_get_left(s) >= 6) while (stream_get_left(s) >= 6)
@ -170,7 +170,7 @@ void cliprdr_process_long_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint32
if (cliprdr->num_format_names >= allocated_formats) if (cliprdr->num_format_names >= allocated_formats)
{ {
allocated_formats *= 2; allocated_formats *= 2;
cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) xrealloc(cliprdr->format_names, cliprdr->format_names = (CLIPRDR_FORMAT_NAME*) realloc(cliprdr->format_names,
sizeof(CLIPRDR_FORMAT_NAME) * allocated_formats); sizeof(CLIPRDR_FORMAT_NAME) * allocated_formats);
} }
@ -204,7 +204,7 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataL
if (dataLen > 0) if (dataLen > 0)
{ {
cb_event->raw_format_data = (uint8*) xmalloc(dataLen); cb_event->raw_format_data = (uint8*) malloc(dataLen);
memcpy(cb_event->raw_format_data, stream_get_tail(s), dataLen); memcpy(cb_event->raw_format_data, stream_get_tail(s), dataLen);
cb_event->raw_format_data_size = dataLen; cb_event->raw_format_data_size = dataLen;
} }
@ -215,7 +215,7 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataL
cliprdr_process_short_format_names(cliprdr, s, dataLen, msgFlags); cliprdr_process_short_format_names(cliprdr, s, dataLen, msgFlags);
if (cliprdr->num_format_names > 0) if (cliprdr->num_format_names > 0)
cb_event->formats = (uint32*) xmalloc(sizeof(uint32) * cliprdr->num_format_names); cb_event->formats = (uint32*) malloc(sizeof(uint32) * cliprdr->num_format_names);
cb_event->num_formats = 0; cb_event->num_formats = 0;
@ -271,10 +271,10 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataL
cb_event->formats[cb_event->num_formats++] = format; cb_event->formats[cb_event->num_formats++] = format;
if (format_name->length > 0) if (format_name->length > 0)
xfree(format_name->name); free(format_name->name);
} }
xfree(cliprdr->format_names); free(cliprdr->format_names);
cliprdr->format_names = NULL; cliprdr->format_names = NULL;
cliprdr->num_format_names = 0; cliprdr->num_format_names = 0;
@ -348,7 +348,7 @@ void cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, STREAM* s, uin
if (dataLen > 0) if (dataLen > 0)
{ {
cb_event->size = dataLen; cb_event->size = dataLen;
cb_event->data = (uint8*) xmalloc(dataLen); cb_event->data = (uint8*) malloc(dataLen);
memcpy(cb_event->data, stream_get_tail(s), dataLen); memcpy(cb_event->data, stream_get_tail(s), dataLen);
} }

View File

@ -268,7 +268,7 @@ static void cliprdr_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event)
static void cliprdr_process_terminate(rdpSvcPlugin* plugin) static void cliprdr_process_terminate(rdpSvcPlugin* plugin)
{ {
xfree(plugin); free(plugin);
} }
/* cliprdr is always built-in */ /* cliprdr is always built-in */

View File

@ -190,7 +190,7 @@ static boolean disk_file_remove_dir(const char* path)
static void disk_file_set_fullpath(DISK_FILE* file, char* fullpath) static void disk_file_set_fullpath(DISK_FILE* file, char* fullpath)
{ {
xfree(file->fullpath); free(file->fullpath);
file->fullpath = fullpath; file->fullpath = fullpath;
file->filename = strrchr(file->fullpath, '/'); file->filename = strrchr(file->fullpath, '/');
@ -341,9 +341,9 @@ void disk_file_free(DISK_FILE* file)
unlink(file->fullpath); unlink(file->fullpath);
} }
xfree(file->pattern); free(file->pattern);
xfree(file->fullpath); free(file->fullpath);
xfree(file); free(file);
} }
boolean disk_file_seek(DISK_FILE* file, uint64 Offset) boolean disk_file_seek(DISK_FILE* file, uint64 Offset)
@ -516,7 +516,7 @@ boolean disk_file_set_information(DISK_FILE* file, uint32 FsInformationClass, ui
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(input), &s, FileNameLength / 2); freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(input), &s, FileNameLength / 2);
fullpath = disk_file_combine_fullpath(file->basepath, s); fullpath = disk_file_combine_fullpath(file->basepath, s);
xfree(s); free(s);
/* TODO rename does not work on win32 */ /* TODO rename does not work on win32 */
if (rename(file->fullpath, fullpath) == 0) if (rename(file->fullpath, fullpath) == 0)
@ -562,7 +562,7 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui
if (InitialQuery != 0) if (InitialQuery != 0)
{ {
rewinddir(file->dir); rewinddir(file->dir);
xfree(file->pattern); free(file->pattern);
if (path[0]) if (path[0])
file->pattern = _strdup(strrchr(path, '\\') + 1); file->pattern = _strdup(strrchr(path, '\\') + 1);
@ -606,7 +606,7 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui
} }
DEBUG_SVC(" pattern %s matched %s", file->pattern, ent_path); DEBUG_SVC(" pattern %s matched %s", file->pattern, ent_path);
xfree(ent_path); free(ent_path);
length = freerdp_AsciiToUnicodeAlloc(ent->d_name, &ent_path, 0) * 2; length = freerdp_AsciiToUnicodeAlloc(ent->d_name, &ent_path, 0) * 2;
@ -688,7 +688,7 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui
break; break;
} }
xfree(ent_path); free(ent_path);
return ret; return ret;
} }

View File

@ -186,7 +186,7 @@ static void disk_process_irp_create(DISK_DEVICE* disk, IRP* irp)
stream_write_uint32(irp->output, FileId); stream_write_uint32(irp->output, FileId);
stream_write_uint8(irp->output, Information); stream_write_uint8(irp->output, Information);
xfree(path); free(path);
irp->Complete(irp); irp->Complete(irp);
} }
@ -244,11 +244,11 @@ static void disk_process_irp_read(DISK_DEVICE* disk, IRP* irp)
} }
else else
{ {
buffer = (uint8*) xmalloc(Length); buffer = (uint8*) malloc(Length);
if (!disk_file_read(file, buffer, &Length)) if (!disk_file_read(file, buffer, &Length))
{ {
irp->IoStatus = STATUS_UNSUCCESSFUL; irp->IoStatus = STATUS_UNSUCCESSFUL;
xfree(buffer); free(buffer);
buffer = NULL; buffer = NULL;
Length = 0; Length = 0;
@ -268,7 +268,7 @@ static void disk_process_irp_read(DISK_DEVICE* disk, IRP* irp)
stream_write(irp->output, buffer, Length); stream_write(irp->output, buffer, Length);
} }
xfree(buffer); free(buffer);
irp->Complete(irp); irp->Complete(irp);
} }
@ -409,7 +409,7 @@ static void disk_process_irp_query_volume_information(DISK_DEVICE* disk, IRP* ir
stream_write_uint8(output, 0); /* SupportsObjects */ stream_write_uint8(output, 0); /* SupportsObjects */
/* Reserved(1), MUST NOT be added! */ /* Reserved(1), MUST NOT be added! */
stream_write(output, outStr, length); /* VolumeLabel (Unicode) */ stream_write(output, outStr, length); /* VolumeLabel (Unicode) */
xfree(outStr); free(outStr);
break; break;
case FileFsSizeInformation: case FileFsSizeInformation:
@ -434,7 +434,7 @@ static void disk_process_irp_query_volume_information(DISK_DEVICE* disk, IRP* ir
stream_write_uint32(output, svfst.f_namemax/*510*/); /* MaximumComponentNameLength */ stream_write_uint32(output, svfst.f_namemax/*510*/); /* MaximumComponentNameLength */
stream_write_uint32(output, length); /* FileSystemNameLength */ stream_write_uint32(output, length); /* FileSystemNameLength */
stream_write(output, outStr, length); /* FileSystemName (Unicode) */ stream_write(output, outStr, length); /* FileSystemName (Unicode) */
xfree(outStr); free(outStr);
break; break;
case FileFsFullSizeInformation: case FileFsFullSizeInformation:
@ -494,7 +494,7 @@ static void disk_process_irp_query_directory(DISK_DEVICE* disk, IRP* irp)
irp->IoStatus = STATUS_NO_MORE_FILES; irp->IoStatus = STATUS_NO_MORE_FILES;
} }
xfree(path); free(path);
irp->Complete(irp); irp->Complete(irp);
} }
@ -640,7 +640,7 @@ static void disk_free(DEVICE* device)
disk_file_free(file); disk_file_free(file);
list_free(disk->files); list_free(disk->files);
xfree(disk); free(disk);
} }
void disk_register_disk_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, char* name, char* path) void disk_register_disk_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, char* name, char* path)

View File

@ -362,7 +362,7 @@ static void drdynvc_process_terminate(rdpSvcPlugin* plugin)
if (drdynvc->channel_mgr != NULL) if (drdynvc->channel_mgr != NULL)
dvcman_free(drdynvc->channel_mgr); dvcman_free(drdynvc->channel_mgr);
xfree(drdynvc); free(drdynvc);
} }
/* drdynvc is always built-in */ /* drdynvc is always built-in */

View File

@ -251,7 +251,7 @@ static void dvcman_channel_free(DVCMAN_CHANNEL* channel)
if (channel->channel_callback) if (channel->channel_callback)
channel->channel_callback->OnClose(channel->channel_callback); channel->channel_callback->OnClose(channel->channel_callback);
xfree(channel); free(channel);
} }
void dvcman_free(IWTSVirtualChannelManager* pChannelMgr) void dvcman_free(IWTSVirtualChannelManager* pChannelMgr)
@ -270,8 +270,8 @@ void dvcman_free(IWTSVirtualChannelManager* pChannelMgr)
for (i = 0; i < dvcman->num_listeners; i++) for (i = 0; i < dvcman->num_listeners; i++)
{ {
listener = (DVCMAN_LISTENER*) dvcman->listeners[i]; listener = (DVCMAN_LISTENER*) dvcman->listeners[i];
xfree(listener->channel_name); free(listener->channel_name);
xfree(listener); free(listener);
} }
for (i = 0; i < dvcman->num_plugins; i++) for (i = 0; i < dvcman->num_plugins; i++)
@ -282,7 +282,7 @@ void dvcman_free(IWTSVirtualChannelManager* pChannelMgr)
pPlugin->Terminated(pPlugin); pPlugin->Terminated(pPlugin);
} }
xfree(dvcman); free(dvcman);
} }
int dvcman_init(IWTSVirtualChannelManager* pChannelMgr) int dvcman_init(IWTSVirtualChannelManager* pChannelMgr)

View File

@ -106,7 +106,7 @@ static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)
stream_write_uint32(irp->output, parallel->id); stream_write_uint32(irp->output, parallel->id);
stream_write_uint8(irp->output, 0); stream_write_uint8(irp->output, 0);
xfree(path); free(path);
irp->Complete(irp); irp->Complete(irp);
} }
@ -133,14 +133,14 @@ static void parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp)
stream_read_uint32(irp->input, Length); stream_read_uint32(irp->input, Length);
stream_read_uint64(irp->input, Offset); stream_read_uint64(irp->input, Offset);
buffer = (uint8*) xmalloc(Length); buffer = (uint8*) malloc(Length);
status = read(parallel->file, irp->output->p, Length); status = read(parallel->file, irp->output->p, Length);
if (status < 0) if (status < 0)
{ {
irp->IoStatus = STATUS_UNSUCCESSFUL; irp->IoStatus = STATUS_UNSUCCESSFUL;
xfree(buffer); free(buffer);
buffer = NULL; buffer = NULL;
Length = 0; Length = 0;
@ -157,7 +157,7 @@ static void parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp)
stream_check_size(irp->output, Length); stream_check_size(irp->output, Length);
stream_write(irp->output, buffer, Length); stream_write(irp->output, buffer, Length);
} }
xfree(buffer); free(buffer);
irp->Complete(irp); irp->Complete(irp);
} }
@ -304,7 +304,7 @@ static void parallel_free(DEVICE* device)
_aligned_free(parallel->pIrpList); _aligned_free(parallel->pIrpList);
xfree(parallel); free(parallel);
} }
int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)

View File

@ -119,7 +119,7 @@ static void printer_cups_close_printjob(rdpPrintJob* printjob)
DEBUG_WARN("cupsPrintFile: %s", cupsLastErrorString()); DEBUG_WARN("cupsPrintFile: %s", cupsLastErrorString());
} }
unlink(cups_printjob->printjob_object); unlink(cups_printjob->printjob_object);
xfree(cups_printjob->printjob_object); free(cups_printjob->printjob_object);
} }
#else #else
@ -131,7 +131,7 @@ static void printer_cups_close_printjob(rdpPrintJob* printjob)
#endif #endif
((rdpCupsPrinter*)printjob->printer)->printjob = NULL; ((rdpCupsPrinter*)printjob->printer)->printjob = NULL;
xfree(cups_printjob) ; free(cups_printjob) ;
} }
static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, uint32 id) static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, uint32 id)
@ -162,7 +162,7 @@ static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, uint32 id)
if (cups_printjob->printjob_object == NULL) if (cups_printjob->printjob_object == NULL)
{ {
DEBUG_WARN("httpConnectEncrypt: %s", cupsLastErrorString()); DEBUG_WARN("httpConnectEncrypt: %s", cupsLastErrorString());
xfree(cups_printjob); free(cups_printjob);
return NULL; return NULL;
} }
@ -174,7 +174,7 @@ static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, uint32 id)
{ {
DEBUG_WARN("cupsCreateJob: %s", cupsLastErrorString()); DEBUG_WARN("cupsCreateJob: %s", cupsLastErrorString());
httpClose((http_t*)cups_printjob->printjob_object); httpClose((http_t*)cups_printjob->printjob_object);
xfree(cups_printjob); free(cups_printjob);
return NULL; return NULL;
} }
cupsStartDocument((http_t*)cups_printjob->printjob_object, cupsStartDocument((http_t*)cups_printjob->printjob_object,
@ -207,8 +207,8 @@ static void printer_cups_free_printer(rdpPrinter* printer)
if (cups_printer->printjob) if (cups_printer->printjob)
cups_printer->printjob->printjob.Close((rdpPrintJob*)cups_printer->printjob); cups_printer->printjob->printjob.Close((rdpPrintJob*)cups_printer->printjob);
xfree(printer->name); free(printer->name);
xfree(printer); free(printer);
} }
static rdpPrinter* printer_cups_new_printer(rdpCupsPrinterDriver* cups_driver, const char* name, boolean is_default) static rdpPrinter* printer_cups_new_printer(rdpCupsPrinterDriver* cups_driver, const char* name, boolean is_default)

View File

@ -227,9 +227,9 @@ static void printer_free(DEVICE* device)
if (printer_dev->printer) if (printer_dev->printer)
printer_dev->printer->Free(printer_dev->printer); printer_dev->printer->Free(printer_dev->printer);
xfree(printer_dev->device.name); free(printer_dev->device.name);
xfree(printer_dev); free(printer_dev);
} }
void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* printer) void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* printer)
@ -244,7 +244,7 @@ void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* pri
uint8* CachedPrinterConfigData; uint8* CachedPrinterConfigData;
PRINTER_DEVICE* printer_dev; PRINTER_DEVICE* printer_dev;
port = xmalloc(10); port = malloc(10);
snprintf(port, 10, "PRN%d", printer->id); snprintf(port, 10, "PRN%d", printer->id);
printer_dev = xnew(PRINTER_DEVICE); printer_dev = xnew(PRINTER_DEVICE);
@ -287,8 +287,8 @@ void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* pri
stream_write(printer_dev->device.data, CachedPrinterConfigData, CachedFieldsLen); stream_write(printer_dev->device.data, CachedPrinterConfigData, CachedFieldsLen);
} }
xfree(DriverName); free(DriverName);
xfree(PrintName); free(PrintName);
printer_dev->pIrpList = (PSLIST_HEADER) _aligned_malloc(sizeof(SLIST_HEADER), MEMORY_ALLOCATION_ALIGNMENT); printer_dev->pIrpList = (PSLIST_HEADER) _aligned_malloc(sizeof(SLIST_HEADER), MEMORY_ALLOCATION_ALIGNMENT);
InitializeSListHead(printer_dev->pIrpList); InitializeSListHead(printer_dev->pIrpList);
@ -354,7 +354,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)
printer_register(pEntryPoints, printer); printer_register(pEntryPoints, printer);
} }
xfree(printers); free(printers);
} }
return 0; return 0;

View File

@ -104,7 +104,7 @@ static void printer_win_close_printjob(rdpPrintJob* printjob)
DEBUG_WINPR("ClosePrinter failed");; DEBUG_WINPR("ClosePrinter failed");;
((rdpWinPrinter*)printjob->printer)->printjob = NULL; ((rdpWinPrinter*)printjob->printer)->printjob = NULL;
xfree(win_printjob) ; free(win_printjob) ;
} }
static rdpPrintJob* printer_win_create_printjob(rdpPrinter* printer, uint32 id) static rdpPrintJob* printer_win_create_printjob(rdpPrinter* printer, uint32 id)
@ -163,8 +163,8 @@ static void printer_win_free_printer(rdpPrinter* printer)
if (win_printer->printjob) if (win_printer->printjob)
win_printer->printjob->printjob.Close((rdpPrintJob*)win_printer->printjob); win_printer->printjob->printjob.Close((rdpPrintJob*)win_printer->printjob);
xfree(printer->name); free(printer->name);
xfree(printer); free(printer);
} }
static rdpPrinter* printer_win_new_printer(rdpWinPrinterDriver* win_driver, const char* name, const wchar_t* drivername, boolean is_default) static rdpPrinter* printer_win_new_printer(rdpWinPrinterDriver* win_driver, const char* name, const wchar_t* drivername, boolean is_default)
@ -194,7 +194,7 @@ static rdpPrinter* printer_win_new_printer(rdpWinPrinterDriver* win_driver, cons
prninfo = (PRINTER_INFO_2*) GlobalAlloc(GPTR,needed); prninfo = (PRINTER_INFO_2*) GlobalAlloc(GPTR,needed);
GetPrinter(win_printer->hPrinter, 2, (LPBYTE) prninfo, needed, &needed); GetPrinter(win_printer->hPrinter, 2, (LPBYTE) prninfo, needed, &needed);
win_printer->printer.driver = xmalloc(1000); win_printer->printer.driver = malloc(1000);
wcstombs_s(&charsConverted, win_printer->printer.driver, 1000, prninfo->pDriverName, _TRUNCATE); wcstombs_s(&charsConverted, win_printer->printer.driver, 1000, prninfo->pDriverName, _TRUNCATE);
return (rdpPrinter*)win_printer; return (rdpPrinter*)win_printer;

View File

@ -22,8 +22,12 @@
#include "config.h" #include "config.h"
#endif #endif
#include <stdio.h>
#include <stdlib.h>
#include <winpr/crt.h>
#include <freerdp/utils/rail.h> #include <freerdp/utils/rail.h>
#include <freerdp/utils/memory.h>
#include <freerdp/utils/unicode.h> #include <freerdp/utils/unicode.h>
#include "rail_orders.h" #include "rail_orders.h"
@ -71,7 +75,7 @@ void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, RAIL_
int length = 0; int length = 0;
if (unicode_string->string != NULL) if (unicode_string->string != NULL)
xfree(unicode_string->string); free(unicode_string->string);
unicode_string->string = NULL; unicode_string->string = NULL;
unicode_string->length = 0; unicode_string->length = 0;
@ -630,14 +634,15 @@ void rail_send_client_langbar_info_order(rdpRailOrder* rail_order)
s = rail_pdu_init(RAIL_LANGBAR_INFO_ORDER_LENGTH); s = rail_pdu_init(RAIL_LANGBAR_INFO_ORDER_LENGTH);
rail_write_langbar_info_order(s, &rail_order->langbar_info); rail_write_langbar_info_order(s, &rail_order->langbar_info);
rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_LANGBAR_INFO); rail_send_pdu(rail_order, s, RAIL_ORDER_TYPE_LANGBAR_INFO);
stream_free(s) ; stream_free(s);
} }
rdpRailOrder* rail_order_new() rdpRailOrder* rail_order_new()
{ {
rdpRailOrder* rail_order; rdpRailOrder* rail_order;
rail_order = xnew(rdpRailOrder); rail_order = (rdpRailOrder*) malloc(sizeof(rdpRailOrder));
ZeroMemory(rail_order, sizeof(rdpRailOrder));
if (rail_order != NULL) if (rail_order != NULL)
{ {
@ -652,7 +657,7 @@ void rail_order_free(rdpRailOrder* rail_order)
if (rail_order != NULL) if (rail_order != NULL)
{ {
xfree(rail_order); free(rail_order);
} }
} }

View File

@ -58,7 +58,7 @@ void devman_free(DEVMAN* devman)
list_free(devman->devices); list_free(devman->devices);
xfree(devman); free(devman);
} }
static void devman_register_device(DEVMAN* devman, DEVICE* device) static void devman_register_device(DEVMAN* devman, DEVICE* device)

View File

@ -118,7 +118,7 @@ static void rdpdr_send_client_name_request(rdpdrPlugin* rdpdr)
stream_write(data_out, computerNameW, computerNameLenW); stream_write(data_out, computerNameW, computerNameLenW);
stream_write_uint16(data_out, 0); /* null terminator */ stream_write_uint16(data_out, 0); /* null terminator */
xfree(computerNameW); free(computerNameW);
svc_plugin_send((rdpSvcPlugin*) rdpdr, data_out); svc_plugin_send((rdpSvcPlugin*) rdpdr, data_out);
} }
@ -313,7 +313,7 @@ static void rdpdr_process_terminate(rdpSvcPlugin* plugin)
rdpdrPlugin* rdpdr = (rdpdrPlugin*) plugin; rdpdrPlugin* rdpdr = (rdpdrPlugin*) plugin;
devman_free(rdpdr->devman); devman_free(rdpdr->devman);
xfree(plugin); free(plugin);
} }
/* rdpdr is always built-in */ /* rdpdr is always built-in */

View File

@ -257,9 +257,9 @@ static void rdpsnd_alsa_free(rdpsndDevicePlugin* device)
rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*)device; rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*)device;
rdpsnd_alsa_close(device); rdpsnd_alsa_close(device);
xfree(alsa->device_name); free(alsa->device_name);
freerdp_dsp_context_free(alsa->dsp_context); freerdp_dsp_context_free(alsa->dsp_context);
xfree(alsa); free(alsa);
} }
static boolean rdpsnd_alsa_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format) static boolean rdpsnd_alsa_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format)

View File

@ -357,9 +357,9 @@ static void rdpsnd_pulse_free(rdpsndDevicePlugin* device)
pulse->mainloop = NULL; pulse->mainloop = NULL;
} }
xfree(pulse->device_name); free(pulse->device_name);
freerdp_dsp_context_free(pulse->dsp_context); freerdp_dsp_context_free(pulse->dsp_context);
xfree(pulse); free(pulse);
} }
static boolean rdpsnd_pulse_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format) static boolean rdpsnd_pulse_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format)

View File

@ -104,7 +104,7 @@ static void rdpsnd_process_interval(rdpSvcPlugin* plugin)
item = (struct data_out_item*) list_dequeue(rdpsnd->data_out_list); item = (struct data_out_item*) list_dequeue(rdpsnd->data_out_list);
svc_plugin_send(plugin, item->data_out); svc_plugin_send(plugin, item->data_out);
xfree(item); free(item);
DEBUG_SVC("processed data_out"); DEBUG_SVC("processed data_out");
} }
@ -135,8 +135,8 @@ static void rdpsnd_free_supported_formats(rdpsndPlugin* rdpsnd)
uint16 i; uint16 i;
for (i = 0; i < rdpsnd->n_supported_formats; i++) for (i = 0; i < rdpsnd->n_supported_formats; i++)
xfree(rdpsnd->supported_formats[i].data); free(rdpsnd->supported_formats[i].data);
xfree(rdpsnd->supported_formats); free(rdpsnd->supported_formats);
rdpsnd->supported_formats = NULL; rdpsnd->supported_formats = NULL;
rdpsnd->n_supported_formats = 0; rdpsnd->n_supported_formats = 0;
@ -224,7 +224,7 @@ static void rdpsnd_process_message_formats(rdpsndPlugin* rdpsnd, STREAM* data_in
stream_write(data_out, format_mark, 18 + format->cbSize); stream_write(data_out, format_mark, 18 + format->cbSize);
if (format->cbSize > 0) if (format->cbSize > 0)
{ {
format->data = xmalloc(format->cbSize); format->data = malloc(format->cbSize);
memcpy(format->data, data_mark, format->cbSize); memcpy(format->data, data_mark, format->cbSize);
} }
n_out_formats++; n_out_formats++;
@ -238,7 +238,7 @@ static void rdpsnd_process_message_formats(rdpsndPlugin* rdpsnd, STREAM* data_in
} }
else else
{ {
xfree(out_formats); free(out_formats);
DEBUG_WARN("no formats supported"); DEBUG_WARN("no formats supported");
} }
@ -443,7 +443,7 @@ static boolean rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name,
strcpy(fullname, "rdpsnd_"); strcpy(fullname, "rdpsnd_");
strcat(fullname, name); strcat(fullname, name);
entry = (PFREERDP_RDPSND_DEVICE_ENTRY)freerdp_load_plugin(fullname, RDPSND_DEVICE_EXPORT_FUNC_NAME); entry = (PFREERDP_RDPSND_DEVICE_ENTRY)freerdp_load_plugin(fullname, RDPSND_DEVICE_EXPORT_FUNC_NAME);
xfree(fullname); free(fullname);
} }
if (entry == NULL) if (entry == NULL)
{ {
@ -556,13 +556,13 @@ static void rdpsnd_process_terminate(rdpSvcPlugin* plugin)
while ((item = list_dequeue(rdpsnd->data_out_list)) != NULL) while ((item = list_dequeue(rdpsnd->data_out_list)) != NULL)
{ {
stream_free(item->data_out); stream_free(item->data_out);
xfree(item); free(item);
} }
list_free(rdpsnd->data_out_list); list_free(rdpsnd->data_out_list);
rdpsnd_free_supported_formats(rdpsnd); rdpsnd_free_supported_formats(rdpsnd);
xfree(plugin); free(plugin);
} }
/* rdpsnd is always built-in */ /* rdpsnd is always built-in */

View File

@ -133,7 +133,7 @@ static boolean rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s)
{ {
if (stream_get_left(s) < 18) if (stream_get_left(s) < 18)
{ {
xfree(rdpsnd->context.client_formats); free(rdpsnd->context.client_formats);
rdpsnd->context.client_formats = NULL; rdpsnd->context.client_formats = NULL;
return false; return false;
} }
@ -290,7 +290,7 @@ static void rdpsnd_server_select_format(rdpsnd_server_context* context, int clie
if (rdpsnd->out_buffer_size < out_buffer_size) if (rdpsnd->out_buffer_size < out_buffer_size)
{ {
rdpsnd->out_buffer = xrealloc(rdpsnd->out_buffer, out_buffer_size); rdpsnd->out_buffer = realloc(rdpsnd->out_buffer, out_buffer_size);
rdpsnd->out_buffer_size = out_buffer_size; rdpsnd->out_buffer_size = out_buffer_size;
} }
@ -479,13 +479,13 @@ void rdpsnd_server_context_free(rdpsnd_server_context* context)
stream_free(rdpsnd->rdpsnd_pdu); stream_free(rdpsnd->rdpsnd_pdu);
if (rdpsnd->out_buffer) if (rdpsnd->out_buffer)
xfree(rdpsnd->out_buffer); free(rdpsnd->out_buffer);
if (rdpsnd->dsp_context) if (rdpsnd->dsp_context)
freerdp_dsp_context_free(rdpsnd->dsp_context); freerdp_dsp_context_free(rdpsnd->dsp_context);
if (rdpsnd->context.client_formats) if (rdpsnd->context.client_formats)
xfree(rdpsnd->context.client_formats); free(rdpsnd->context.client_formats);
xfree(rdpsnd); free(rdpsnd);
} }

View File

@ -129,7 +129,7 @@ static void skel_process_terminate(rdpSvcPlugin* plugin)
/* put your cleanup here */ /* put your cleanup here */
xfree(plugin); free(plugin);
} }
DEFINE_SVC_PLUGIN(skel, "skel", DEFINE_SVC_PLUGIN(skel, "skel",

View File

@ -110,7 +110,7 @@ static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp)
stream_write_uint32(irp->output, FileId); stream_write_uint32(irp->output, FileId);
stream_write_uint8(irp->output, 0); stream_write_uint8(irp->output, 0);
xfree(path); free(path);
irp->Complete(irp); irp->Complete(irp);
} }
@ -162,12 +162,12 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp)
} }
else else
{ {
buffer = (uint8*) xmalloc(Length); buffer = (uint8*) malloc(Length);
if (!serial_tty_read(tty, buffer, &Length)) if (!serial_tty_read(tty, buffer, &Length))
{ {
irp->IoStatus = STATUS_UNSUCCESSFUL; irp->IoStatus = STATUS_UNSUCCESSFUL;
xfree(buffer); free(buffer);
buffer = NULL; buffer = NULL;
Length = 0; Length = 0;
@ -187,7 +187,7 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp)
stream_write(irp->output, buffer, Length); stream_write(irp->output, buffer, Length);
} }
xfree(buffer); free(buffer);
irp->Complete(irp); irp->Complete(irp);
} }
@ -394,7 +394,7 @@ static void serial_free(DEVICE* device)
list_free(serial->pending_irps); list_free(serial->pending_irps);
xfree(serial); free(serial);
} }
int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints)

View File

@ -457,9 +457,9 @@ void serial_tty_free(SERIAL_TTY* tty)
close(tty->fd); close(tty->fd);
} }
xfree(tty->ptermios); free(tty->ptermios);
xfree(tty->pold_termios); free(tty->pold_termios);
xfree(tty); free(tty);
} }

View File

@ -52,13 +52,13 @@ static void scard_free(DEVICE* dev)
/* Begin TS Client defect workaround. */ /* Begin TS Client defect workaround. */
while ((CompletionIdInfo = (COMPLETIONIDINFO*) list_dequeue(scard->CompletionIds)) != NULL) while ((CompletionIdInfo = (COMPLETIONIDINFO*) list_dequeue(scard->CompletionIds)) != NULL)
xfree(CompletionIdInfo); free(CompletionIdInfo);
list_free(scard->CompletionIds); list_free(scard->CompletionIds);
/* End TS Client defect workaround. */ /* End TS Client defect workaround. */
xfree(dev); free(dev);
return; return;
} }
@ -106,7 +106,7 @@ static void scard_process_irp_thread_func(struct scard_irp_thread_args* args)
scard_process_irp(args->scard, args->irp); scard_process_irp(args->scard, args->irp);
freerdp_thread_free(args->thread); freerdp_thread_free(args->thread);
xfree(args); free(args);
} }
static void* scard_thread_func(void* arg) static void* scard_thread_func(void* arg)
@ -180,7 +180,7 @@ static boolean scard_check_for_duplicate_id(SCARD_DEVICE* scard, uint32 Complet
DEBUG_WARN("CompletionID number %u was previously marked as a duplicate. The response to the command is removed.", CompletionId); DEBUG_WARN("CompletionID number %u was previously marked as a duplicate. The response to the command is removed.", CompletionId);
} }
list_remove(scard->CompletionIds, CompletionIdInfo); list_remove(scard->CompletionIds, CompletionIdInfo);
xfree(CompletionIdInfo); free(CompletionIdInfo);
return duplicate; return duplicate;
} }
} }
@ -266,7 +266,7 @@ static void scard_irp_request(DEVICE* device, IRP* irp)
* get their own thread * get their own thread
* TODO: revise this mechanism.. maybe worker pool * TODO: revise this mechanism.. maybe worker pool
*/ */
struct scard_irp_thread_args *args = xmalloc(sizeof(struct scard_irp_thread_args)); struct scard_irp_thread_args *args = malloc(sizeof(struct scard_irp_thread_args));
args->thread = freerdp_thread_new(); args->thread = freerdp_thread_new();

View File

@ -185,7 +185,7 @@ static uint32 sc_input_string(IRP* irp, char **dest, uint32 dataLength, boolean
int bufferSize; int bufferSize;
bufferSize = wide ? (2 * dataLength) : dataLength; bufferSize = wide ? (2 * dataLength) : dataLength;
buffer = xmalloc(bufferSize + 2); /* reserve 2 bytes for the '\0' */ buffer = malloc(bufferSize + 2); /* reserve 2 bytes for the '\0' */
stream_read(irp->input, buffer, bufferSize); stream_read(irp->input, buffer, bufferSize);
@ -359,7 +359,7 @@ static uint32 handle_ListReaders(IRP* irp, boolean wide)
#else #else
rv = SCardListReaders(hContext, NULL, NULL, &dwReaders); rv = SCardListReaders(hContext, NULL, NULL, &dwReaders);
readerList = xmalloc(dwReaders); readerList = malloc(dwReaders);
rv = SCardListReaders(hContext, NULL, readerList, &dwReaders); rv = SCardListReaders(hContext, NULL, readerList, &dwReaders);
#endif #endif
if (rv != SCARD_S_SUCCESS) if (rv != SCARD_S_SUCCESS)
@ -409,7 +409,7 @@ static uint32 handle_ListReaders(IRP* irp, boolean wide)
#ifdef SCARD_AUTOALLOCATE #ifdef SCARD_AUTOALLOCATE
SCardFreeMemory(hContext, readerList); SCardFreeMemory(hContext, readerList);
#else #else
xfree(readerList); free(readerList);
#endif #endif
return rv; return rv;
@ -517,12 +517,12 @@ static uint32 handle_GetStatusChange(IRP* irp, boolean wide)
stream_write_zero(irp->output, 4); stream_write_zero(irp->output, 4);
xfree((void *)cur->szReader); free((void *)cur->szReader);
} }
sc_output_alignment(irp, 8); sc_output_alignment(irp, 8);
xfree(readerStates); free(readerStates);
return rv; return rv;
} }
@ -587,7 +587,7 @@ static uint32 handle_Connect(IRP* irp, boolean wide)
sc_output_alignment(irp, 8); sc_output_alignment(irp, 8);
xfree(readerName); free(readerName);
return rv; return rv;
} }
@ -729,7 +729,7 @@ static uint32 handle_State(IRP* irp)
rv = SCardStatus(hCard, (LPSTR) &readerName, &readerLen, &state, &protocol, pbAtr, &atrLen); rv = SCardStatus(hCard, (LPSTR) &readerName, &readerLen, &state, &protocol, pbAtr, &atrLen);
#else #else
readerLen = 256; readerLen = 256;
readerName = xmalloc(readerLen); readerName = malloc(readerLen);
rv = SCardStatus(hCard, (LPSTR) readerName, &readerLen, &state, &protocol, pbAtr, &atrLen); rv = SCardStatus(hCard, (LPSTR) readerName, &readerLen, &state, &protocol, pbAtr, &atrLen);
#endif #endif
@ -763,9 +763,9 @@ static uint32 handle_State(IRP* irp)
sc_output_alignment(irp, 8); sc_output_alignment(irp, 8);
#ifdef SCARD_AUTOALLOCATE #ifdef SCARD_AUTOALLOCATE
xfree(readerName); free(readerName);
#else #else
xfree(readerName); free(readerName);
#endif #endif
return rv; return rv;
@ -802,7 +802,7 @@ static DWORD handle_Status(IRP *irp, boolean wide)
rv = SCardStatus(hCard, (LPSTR) &readerName, &readerLen, &state, &protocol, pbAtr, &atrLen); rv = SCardStatus(hCard, (LPSTR) &readerName, &readerLen, &state, &protocol, pbAtr, &atrLen);
#else #else
readerLen = 256; readerLen = 256;
readerName = xmalloc(readerLen); readerName = malloc(readerLen);
rv = SCardStatus(hCard, (LPSTR) readerName, &readerLen, &state, &protocol, pbAtr, &atrLen); rv = SCardStatus(hCard, (LPSTR) readerName, &readerLen, &state, &protocol, pbAtr, &atrLen);
#endif #endif
@ -856,7 +856,7 @@ static DWORD handle_Status(IRP *irp, boolean wide)
/* SCardFreeMemory(NULL, readerName); */ /* SCardFreeMemory(NULL, readerName); */
free(readerName); free(readerName);
#else #else
xfree(readerName); free(readerName);
#endif #endif
return rv; return rv;
@ -909,13 +909,13 @@ static uint32 handle_Transmit(IRP* irp)
/* send buffer */ /* send buffer */
stream_read_uint32(irp->input, linkedLen); stream_read_uint32(irp->input, linkedLen);
sendBuf = xmalloc(linkedLen); sendBuf = malloc(linkedLen);
stream_read(irp->input, sendBuf, linkedLen); stream_read(irp->input, sendBuf, linkedLen);
sc_input_repos(irp, linkedLen); sc_input_repos(irp, linkedLen);
} }
if (cbRecvLength) if (cbRecvLength)
recvBuf = xmalloc(cbRecvLength); recvBuf = malloc(cbRecvLength);
if (map[4] & SCARD_INPUT_LINKED) if (map[4] & SCARD_INPUT_LINKED)
{ {
@ -968,8 +968,8 @@ static uint32 handle_Transmit(IRP* irp)
sc_output_alignment(irp, 8); sc_output_alignment(irp, 8);
xfree(sendBuf); free(sendBuf);
xfree(recvBuf); free(recvBuf);
return rv; return rv;
} }
@ -1014,7 +1014,7 @@ static uint32 handle_Control(IRP* irp)
/* read real input size */ /* read real input size */
stream_read_uint32(irp->input, recvLength); stream_read_uint32(irp->input, recvLength);
recvBuffer = xmalloc(recvLength); recvBuffer = malloc(recvLength);
if (!recvBuffer) if (!recvBuffer)
return sc_output_return(irp, SCARD_E_NO_MEMORY); return sc_output_return(irp, SCARD_E_NO_MEMORY);
@ -1023,7 +1023,7 @@ static uint32 handle_Control(IRP* irp)
} }
nBytesReturned = outBufferSize; nBytesReturned = outBufferSize;
sendBuffer = xmalloc(outBufferSize); sendBuffer = malloc(outBufferSize);
if (!sendBuffer) if (!sendBuffer)
return sc_output_return(irp, SCARD_E_NO_MEMORY); return sc_output_return(irp, SCARD_E_NO_MEMORY);
@ -1048,8 +1048,8 @@ static uint32 handle_Control(IRP* irp)
sc_output_alignment(irp, 8); sc_output_alignment(irp, 8);
xfree(recvBuffer); free(recvBuffer);
xfree(sendBuffer); free(sendBuffer);
return rv; return rv;
} }
@ -1165,7 +1165,7 @@ static uint32 handle_GetAttrib(IRP* irp)
} }
sc_output_alignment(irp, 8); sc_output_alignment(irp, 8);
xfree(pbAttr); free(pbAttr);
return rv; return rv;
} }
@ -1212,7 +1212,7 @@ static uint32 handle_LocateCardsByATR(IRP* irp, boolean wide)
stream_read_uint32(irp->input, hContext); stream_read_uint32(irp->input, hContext);
stream_read_uint32(irp->input, atrMaskCount); stream_read_uint32(irp->input, atrMaskCount);
pAtrMasks = xmalloc(atrMaskCount * sizeof(SERVER_SCARD_ATRMASK)); pAtrMasks = malloc(atrMaskCount * sizeof(SERVER_SCARD_ATRMASK));
if (!pAtrMasks) if (!pAtrMasks)
return sc_output_return(irp, SCARD_E_NO_MEMORY); return sc_output_return(irp, SCARD_E_NO_MEMORY);
@ -1317,7 +1317,7 @@ static uint32 handle_LocateCardsByATR(IRP* irp, boolean wide)
stream_write_zero(irp->output, 4); stream_write_zero(irp->output, 4);
xfree((void*) cur->szReader); free((void*) cur->szReader);
} }
sc_output_alignment(irp, 8); sc_output_alignment(irp, 8);

View File

@ -209,7 +209,7 @@ static boolean tsmf_alsa_play(ITSMFAudioDevice* audio, uint8* data, uint32 data_
pindex += error * rbytes_per_frame; pindex += error * rbytes_per_frame;
} }
} }
xfree(data); free(data);
return true; return true;
} }
@ -245,7 +245,7 @@ static void tsmf_alsa_free(ITSMFAudioDevice* audio)
snd_pcm_close(alsa->out_handle); snd_pcm_close(alsa->out_handle);
} }
freerdp_dsp_context_free(alsa->dsp_context); freerdp_dsp_context_free(alsa->dsp_context);
xfree(alsa); free(alsa);
} }
ITSMFAudioDevice* TSMFAudioDeviceEntry(void) ITSMFAudioDevice* TSMFAudioDeviceEntry(void)

View File

@ -356,7 +356,7 @@ static boolean tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const uint8* data
if (mdecoder->decoded_size_max - mdecoder->decoded_size < AVCODEC_MAX_AUDIO_FRAME_SIZE) if (mdecoder->decoded_size_max - mdecoder->decoded_size < AVCODEC_MAX_AUDIO_FRAME_SIZE)
{ {
mdecoder->decoded_size_max = mdecoder->decoded_size_max * 2 + 16; mdecoder->decoded_size_max = mdecoder->decoded_size_max * 2 + 16;
mdecoder->decoded_data = xrealloc(mdecoder->decoded_data, mdecoder->decoded_size_max); mdecoder->decoded_data = realloc(mdecoder->decoded_data, mdecoder->decoded_size_max);
dst = (uint8*) (((uintptr_t)mdecoder->decoded_data + 15) & ~ 0x0F); dst = (uint8*) (((uintptr_t)mdecoder->decoded_data + 15) & ~ 0x0F);
if (dst - mdecoder->decoded_data != dst_offset) if (dst - mdecoder->decoded_data != dst_offset)
{ {
@ -404,7 +404,7 @@ static boolean tsmf_ffmpeg_decode_audio(ITSMFDecoder* decoder, const uint8* data
if (mdecoder->decoded_size == 0) if (mdecoder->decoded_size == 0)
{ {
xfree(mdecoder->decoded_data); free(mdecoder->decoded_data);
mdecoder->decoded_data = NULL; mdecoder->decoded_data = NULL;
} }
else if (dst_offset) else if (dst_offset)
@ -425,7 +425,7 @@ static boolean tsmf_ffmpeg_decode(ITSMFDecoder* decoder, const uint8* data, uint
if (mdecoder->decoded_data) if (mdecoder->decoded_data)
{ {
xfree(mdecoder->decoded_data); free(mdecoder->decoded_data);
mdecoder->decoded_data = NULL; mdecoder->decoded_data = NULL;
} }
mdecoder->decoded_size = 0; mdecoder->decoded_size = 0;
@ -493,16 +493,16 @@ static void tsmf_ffmpeg_free(ITSMFDecoder* decoder)
if (mdecoder->frame) if (mdecoder->frame)
av_free(mdecoder->frame); av_free(mdecoder->frame);
if (mdecoder->decoded_data) if (mdecoder->decoded_data)
xfree(mdecoder->decoded_data); free(mdecoder->decoded_data);
if (mdecoder->codec_context) if (mdecoder->codec_context)
{ {
if (mdecoder->prepared) if (mdecoder->prepared)
avcodec_close(mdecoder->codec_context); avcodec_close(mdecoder->codec_context);
if (mdecoder->codec_context->extradata) if (mdecoder->codec_context->extradata)
xfree(mdecoder->codec_context->extradata); free(mdecoder->codec_context->extradata);
av_free(mdecoder->codec_context); av_free(mdecoder->codec_context);
} }
xfree(decoder); free(decoder);
} }
static boolean initialized = false; static boolean initialized = false;

View File

@ -336,7 +336,7 @@ static boolean tsmf_pulse_play(ITSMFAudioDevice* audio, uint8* data, uint32 data
pa_threaded_mainloop_unlock(pulse->mainloop); pa_threaded_mainloop_unlock(pulse->mainloop);
} }
xfree(data); free(data);
return true; return true;
} }
@ -386,7 +386,7 @@ static void tsmf_pulse_free(ITSMFAudioDevice* audio)
pa_threaded_mainloop_free(pulse->mainloop); pa_threaded_mainloop_free(pulse->mainloop);
pulse->mainloop = NULL; pulse->mainloop = NULL;
} }
xfree(pulse); free(pulse);
} }
ITSMFAudioDevice* TSMFAudioDeviceEntry(void) ITSMFAudioDevice* TSMFAudioDeviceEntry(void)

View File

@ -44,7 +44,7 @@ static ITSMFAudioDevice* tsmf_load_audio_device_by_name(const char* name, const
strcpy(fullname, "tsmf_"); strcpy(fullname, "tsmf_");
strcat(fullname, name); strcat(fullname, name);
entry = (TSMF_AUDIO_DEVICE_ENTRY) freerdp_load_plugin(fullname, TSMF_AUDIO_DEVICE_EXPORT_FUNC_NAME); entry = (TSMF_AUDIO_DEVICE_ENTRY) freerdp_load_plugin(fullname, TSMF_AUDIO_DEVICE_EXPORT_FUNC_NAME);
xfree(fullname); free(fullname);
} }
if (entry == NULL) if (entry == NULL)
{ {

View File

@ -46,7 +46,7 @@ static ITSMFDecoder* tsmf_load_decoder_by_name(const char* name, TS_AM_MEDIA_TYP
strcpy(fullname, "tsmf_"); strcpy(fullname, "tsmf_");
strcat(fullname, name); strcat(fullname, name);
entry = (TSMF_DECODER_ENTRY) freerdp_load_plugin(fullname, TSMF_DECODER_EXPORT_FUNC_NAME); entry = (TSMF_DECODER_ENTRY) freerdp_load_plugin(fullname, TSMF_DECODER_EXPORT_FUNC_NAME);
xfree(fullname); free(fullname);
} }
if (entry == NULL) if (entry == NULL)
{ {

View File

@ -348,7 +348,7 @@ static int tsmf_on_close(IWTSVirtualChannelCallback* pChannelCallback)
tsmf_stream_free(stream); tsmf_stream_free(stream);
} }
} }
xfree(pChannelCallback); free(pChannelCallback);
return 0; return 0;
} }
@ -396,8 +396,8 @@ static int tsmf_plugin_terminated(IWTSPlugin* pPlugin)
DEBUG_DVC(""); DEBUG_DVC("");
if (tsmf->listener_callback) if (tsmf->listener_callback)
xfree(tsmf->listener_callback); free(tsmf->listener_callback);
xfree(tsmf); free(tsmf);
return 0; return 0;
} }

View File

@ -216,8 +216,8 @@ static TSMF_SAMPLE* tsmf_stream_pop_sample(TSMF_STREAM* stream, int sync)
static void tsmf_sample_free(TSMF_SAMPLE* sample) static void tsmf_sample_free(TSMF_SAMPLE* sample)
{ {
if (sample->data) if (sample->data)
xfree(sample->data); free(sample->data);
xfree(sample); free(sample);
} }
static void tsmf_sample_ack(TSMF_SAMPLE* sample) static void tsmf_sample_ack(TSMF_SAMPLE* sample)
@ -361,7 +361,7 @@ static void tsmf_sample_playback_video(TSMF_SAMPLE* sample)
if (presentation->last_rects) if (presentation->last_rects)
{ {
xfree(presentation->last_rects); free(presentation->last_rects);
presentation->last_rects = NULL; presentation->last_rects = NULL;
} }
presentation->last_num_rects = presentation->output_num_rects; presentation->last_num_rects = presentation->output_num_rects;
@ -477,7 +477,7 @@ static void tsmf_sample_playback(TSMF_SAMPLE* sample)
return; return;
} }
xfree(sample->data); free(sample->data);
sample->data = NULL; sample->data = NULL;
if (stream->major_type == TSMF_MAJOR_TYPE_VIDEO) if (stream->major_type == TSMF_MAJOR_TYPE_VIDEO)
@ -564,7 +564,7 @@ static void tsmf_sample_playback(TSMF_SAMPLE* sample)
{ {
if (presentation->last_rects) if (presentation->last_rects)
{ {
xfree(presentation->last_rects); free(presentation->last_rects);
presentation->last_rects = NULL; presentation->last_rects = NULL;
} }
presentation->last_num_rects = presentation->output_num_rects; presentation->last_num_rects = presentation->output_num_rects;
@ -818,13 +818,13 @@ void tsmf_presentation_stop(TSMF_PRESENTATION* presentation)
tsmf_presentation_restore_last_video_frame(presentation); tsmf_presentation_restore_last_video_frame(presentation);
if (presentation->last_rects) if (presentation->last_rects)
{ {
xfree(presentation->last_rects); free(presentation->last_rects);
presentation->last_rects = NULL; presentation->last_rects = NULL;
} }
presentation->last_num_rects = 0; presentation->last_num_rects = 0;
if (presentation->output_rects) if (presentation->output_rects)
{ {
xfree(presentation->output_rects); free(presentation->output_rects);
presentation->output_rects = NULL; presentation->output_rects = NULL;
} }
presentation->output_num_rects = 0; presentation->output_num_rects = 0;
@ -839,7 +839,7 @@ void tsmf_presentation_set_geometry_info(TSMF_PRESENTATION* presentation,
presentation->output_width = width; presentation->output_width = width;
presentation->output_height = height; presentation->output_height = height;
if (presentation->output_rects) if (presentation->output_rects)
xfree(presentation->output_rects); free(presentation->output_rects);
presentation->output_rects = rects; presentation->output_rects = rects;
presentation->output_num_rects = num_rects; presentation->output_num_rects = num_rects;
} }
@ -907,7 +907,7 @@ void tsmf_presentation_free(TSMF_PRESENTATION* presentation)
CloseHandle(presentation->mutex); CloseHandle(presentation->mutex);
xfree(presentation); free(presentation);
} }
TSMF_STREAM* tsmf_stream_new(TSMF_PRESENTATION* presentation, uint32 stream_id) TSMF_STREAM* tsmf_stream_new(TSMF_PRESENTATION* presentation, uint32 stream_id)
@ -1015,7 +1015,7 @@ void tsmf_stream_free(TSMF_STREAM* stream)
freerdp_thread_free(stream->thread); freerdp_thread_free(stream->thread);
xfree(stream); free(stream);
stream = 0; stream = 0;
} }

View File

@ -1010,7 +1010,7 @@ static int urbdrc_load_udevman_plugin(IWTSPlugin* pPlugin, const char* name, RDP
strcpy(fullname, name); strcpy(fullname, name);
strcat(fullname, "_udevman"); strcat(fullname, "_udevman");
entry = (PFREERDP_URBDRC_DEVICE_ENTRY) freerdp_load_plugin(fullname, URBDRC_UDEVMAN_EXPORT_FUNC_NAME); entry = (PFREERDP_URBDRC_DEVICE_ENTRY) freerdp_load_plugin(fullname, URBDRC_UDEVMAN_EXPORT_FUNC_NAME);
xfree(fullname); free(fullname);
} }
if (entry == NULL) if (entry == NULL)

View File

@ -133,6 +133,6 @@ void df_register_graphics(rdpGraphics* graphics)
pointer->SetDefault = df_Pointer_SetDefault; pointer->SetDefault = df_Pointer_SetDefault;
graphics_register_pointer(graphics, pointer); graphics_register_pointer(graphics, pointer);
xfree(pointer); free(pointer);
} }

View File

@ -306,7 +306,7 @@ df_process_channel_event(rdpChannels* channels, freerdp* instance)
static void df_free(dfInfo* dfi) static void df_free(dfInfo* dfi)
{ {
dfi->dfb->Release(dfi->dfb); dfi->dfb->Release(dfi->dfb);
xfree(dfi); free(dfi);
} }
int dfreerdp_run(freerdp* instance) int dfreerdp_run(freerdp* instance)
@ -421,7 +421,7 @@ void* thread_func(void* param)
dfreerdp_run(data->instance); dfreerdp_run(data->instance);
xfree(data); free(data);
pthread_detach(pthread_self()); pthread_detach(pthread_self());

View File

@ -292,7 +292,7 @@ void* thread_func(void* param)
tfreerdp_run(data->instance); tfreerdp_run(data->instance);
xfree(data); free(data);
pthread_detach(pthread_self()); pthread_detach(pthread_self());

View File

@ -96,7 +96,7 @@ uint8* wf_glyph_convert(wfInfo* wfi, int width, int height, uint8* data)
src_bytes_per_row = (width + 7) / 8; src_bytes_per_row = (width + 7) / 8;
dst_bytes_per_row = src_bytes_per_row + (src_bytes_per_row % 2); dst_bytes_per_row = src_bytes_per_row + (src_bytes_per_row % 2);
cdata = (uint8 *) xmalloc(dst_bytes_per_row * height); cdata = (uint8 *) malloc(dst_bytes_per_row * height);
src = data; src = data;
for (indexy = 0; indexy < height; indexy++) for (indexy = 0; indexy < height; indexy++)
@ -376,7 +376,7 @@ void wf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
if (polyline->numPoints > 0) if (polyline->numPoints > 0)
{ {
pts = (POINT*) xmalloc(sizeof(POINT) * polyline->numPoints); pts = (POINT*) malloc(sizeof(POINT) * polyline->numPoints);
for (i = 0; i < (int) polyline->numPoints; i++) for (i = 0; i < (int) polyline->numPoints; i++)
{ {
@ -388,7 +388,7 @@ void wf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
} }
Polyline(wfi->drawing->hdc, pts, polyline->numPoints); Polyline(wfi->drawing->hdc, pts, polyline->numPoints);
xfree(pts); free(pts);
} }
SelectObject(wfi->drawing->hdc, org_hpen); SelectObject(wfi->drawing->hdc, org_hpen);
@ -466,7 +466,7 @@ void wf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
wfi->image->_bitmap.width = surface_bits_command->width; wfi->image->_bitmap.width = surface_bits_command->width;
wfi->image->_bitmap.height = surface_bits_command->height; wfi->image->_bitmap.height = surface_bits_command->height;
wfi->image->_bitmap.bpp = surface_bits_command->bpp; wfi->image->_bitmap.bpp = surface_bits_command->bpp;
wfi->image->_bitmap.data = (uint8*) xrealloc(wfi->image->_bitmap.data, wfi->image->_bitmap.width * wfi->image->_bitmap.height * 4); wfi->image->_bitmap.data = (uint8*) realloc(wfi->image->_bitmap.data, wfi->image->_bitmap.width * wfi->image->_bitmap.height * 4);
freerdp_image_flip(nsc_context->bmpdata, wfi->image->_bitmap.data, wfi->image->_bitmap.width, wfi->image->_bitmap.height, 32); freerdp_image_flip(nsc_context->bmpdata, wfi->image->_bitmap.data, wfi->image->_bitmap.width, wfi->image->_bitmap.height, 32);
BitBlt(wfi->primary->hdc, surface_bits_command->destLeft, surface_bits_command->destTop, surface_bits_command->width, surface_bits_command->height, wfi->image->hdc, 0, 0, GDI_SRCCOPY); BitBlt(wfi->primary->hdc, surface_bits_command->destLeft, surface_bits_command->destTop, surface_bits_command->width, surface_bits_command->height, wfi->image->hdc, 0, 0, GDI_SRCCOPY);
} }
@ -476,7 +476,7 @@ void wf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
wfi->image->_bitmap.height = surface_bits_command->height; wfi->image->_bitmap.height = surface_bits_command->height;
wfi->image->_bitmap.bpp = surface_bits_command->bpp; wfi->image->_bitmap.bpp = surface_bits_command->bpp;
wfi->image->_bitmap.data = (uint8*) xrealloc(wfi->image->_bitmap.data, wfi->image->_bitmap.data = (uint8*) realloc(wfi->image->_bitmap.data,
wfi->image->_bitmap.width * wfi->image->_bitmap.height * 4); wfi->image->_bitmap.width * wfi->image->_bitmap.height * 4);
if ((surface_bits_command->bpp != 32) || (wfi->clrconv->alpha == true)) if ((surface_bits_command->bpp != 32) || (wfi->clrconv->alpha == true))
@ -490,9 +490,9 @@ void wf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
surface_bits_command->bpp = 32; surface_bits_command->bpp = 32;
surface_bits_command->bitmapData = wfi->image->_bitmap.data; surface_bits_command->bitmapData = wfi->image->_bitmap.data;
temp_image = (uint8*) xmalloc(wfi->image->_bitmap.width * wfi->image->_bitmap.height * 4); temp_image = (uint8*) malloc(wfi->image->_bitmap.width * wfi->image->_bitmap.height * 4);
freerdp_image_flip(wfi->image->_bitmap.data, temp_image, wfi->image->_bitmap.width, wfi->image->_bitmap.height, 32); freerdp_image_flip(wfi->image->_bitmap.data, temp_image, wfi->image->_bitmap.width, wfi->image->_bitmap.height, 32);
xfree(wfi->image->_bitmap.data); free(wfi->image->_bitmap.data);
wfi->image->_bitmap.data = temp_image; wfi->image->_bitmap.data = temp_image;
} }
else else
@ -510,7 +510,7 @@ void wf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
} }
if (tile_bitmap != NULL) if (tile_bitmap != NULL)
xfree(tile_bitmap); free(tile_bitmap);
} }
void wf_gdi_register_update_callbacks(rdpUpdate* update) void wf_gdi_register_update_callbacks(rdpUpdate* update)

View File

@ -71,7 +71,7 @@ wfBitmap* wf_image_new(wfInfo* wfi, int width, int height, int bpp, uint8* data)
wfBitmap* image; wfBitmap* image;
hdc = GetDC(NULL); hdc = GetDC(NULL);
image = (wfBitmap*) xmalloc(sizeof(wfBitmap)); image = (wfBitmap*) malloc(sizeof(wfBitmap));
image->hdc = CreateCompatibleDC(hdc); image->hdc = CreateCompatibleDC(hdc);
image->bitmap = wf_create_dib(wfi, width, height, bpp, data, &(image->pdata)); image->bitmap = wf_create_dib(wfi, width, height, bpp, data, &(image->pdata));
@ -150,9 +150,9 @@ void wf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
size = width * height * (bpp / 8); size = width * height * (bpp / 8);
if (bitmap->data == NULL) if (bitmap->data == NULL)
bitmap->data = (uint8*) xmalloc(size); bitmap->data = (uint8*) malloc(size);
else else
bitmap->data = (uint8*) xrealloc(bitmap->data, size); bitmap->data = (uint8*) realloc(bitmap->data, size);
if (compressed) if (compressed)
{ {

View File

@ -303,12 +303,12 @@ boolean wf_post_connect(freerdp* instance)
wfi->hdc->alpha = wfi->clrconv->alpha; wfi->hdc->alpha = wfi->clrconv->alpha;
wfi->hdc->invert = wfi->clrconv->invert; wfi->hdc->invert = wfi->clrconv->invert;
wfi->hdc->hwnd = (HGDI_WND) xmalloc(sizeof(GDI_WND)); wfi->hdc->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND));
wfi->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0); wfi->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);
wfi->hdc->hwnd->invalid->null = 1; wfi->hdc->hwnd->invalid->null = 1;
wfi->hdc->hwnd->count = 32; wfi->hdc->hwnd->count = 32;
wfi->hdc->hwnd->cinvalid = (HGDI_RGN) xmalloc(sizeof(GDI_RGN) * wfi->hdc->hwnd->count); wfi->hdc->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * wfi->hdc->hwnd->count);
wfi->hdc->hwnd->ninvalid = 0; wfi->hdc->hwnd->ninvalid = 0;
wfi->image = wf_image_new(wfi, 64, 64, 32, NULL); wfi->image = wf_image_new(wfi, 64, 64, 32, NULL);

View File

@ -149,11 +149,11 @@ void xf_cliprdr_uninit(xfInfo* xfi)
if (cb) if (cb)
{ {
xfree(cb->formats); free(cb->formats);
xfree(cb->data); free(cb->data);
xfree(cb->respond); free(cb->respond);
xfree(cb->incr_data); free(cb->incr_data);
xfree(cb); free(cb);
xfi->clipboard_context = NULL; xfi->clipboard_context = NULL;
} }
} }
@ -325,7 +325,7 @@ static void xf_cliprdr_send_raw_format_list(xfInfo* xfi)
event = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, event = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR,
RDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL); RDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL);
event->raw_format_data = (uint8*) xmalloc(length); event->raw_format_data = (uint8*) malloc(length);
memcpy(event->raw_format_data, format_data, length); memcpy(event->raw_format_data, format_data, length);
event->raw_format_data_size = length; event->raw_format_data_size = length;
XFree(format_data); XFree(format_data);
@ -355,7 +355,7 @@ static void xf_cliprdr_send_supported_format_list(xfInfo* xfi)
event = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, event = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR,
RDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL); RDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL);
event->formats = (uint32*) xmalloc(sizeof(uint32) * cb->num_format_mappings); event->formats = (uint32*) malloc(sizeof(uint32) * cb->num_format_mappings);
event->num_formats = cb->num_format_mappings; event->num_formats = cb->num_format_mappings;
for (i = 0; i < cb->num_format_mappings; i++) for (i = 0; i < cb->num_format_mappings; i++)
@ -485,7 +485,7 @@ static void xf_cliprdr_get_requested_targets(xfInfo* xfi)
event = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, event = (RDP_CB_FORMAT_LIST_EVENT*) freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR,
RDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL); RDP_EVENT_TYPE_CB_FORMAT_LIST, NULL, NULL);
event->formats = (uint32*) xmalloc(sizeof(uint32) * cb->num_format_mappings); event->formats = (uint32*) malloc(sizeof(uint32) * cb->num_format_mappings);
num = 0; num = 0;
for (i = 0; i < length; i++) for (i = 0; i < length; i++)
{ {
@ -520,7 +520,7 @@ static uint8* xf_cliprdr_process_requested_raw(uint8* data, int* size)
{ {
uint8* outbuf; uint8* outbuf;
outbuf = (uint8*) xmalloc(*size); outbuf = (uint8*) malloc(*size);
memcpy(outbuf, data, *size); memcpy(outbuf, data, *size);
return outbuf; return outbuf;
} }
@ -533,7 +533,7 @@ static uint8* xf_cliprdr_process_requested_unicodetext(uint8* data, int* size)
inbuf = (char*) lf2crlf(data, size); inbuf = (char*) lf2crlf(data, size);
out_size = freerdp_AsciiToUnicodeAlloc(inbuf, &outbuf, 0); out_size = freerdp_AsciiToUnicodeAlloc(inbuf, &outbuf, 0);
xfree(inbuf); free(inbuf);
*size = (int) ((out_size + 1) * 2); *size = (int) ((out_size + 1) * 2);
@ -633,7 +633,7 @@ static uint8* xf_cliprdr_process_requested_html(uint8* data, int* size)
memcpy(outbuf + 43, num, 10); memcpy(outbuf + 43, num, 10);
*size = strlen((char*) outbuf) + 1; *size = strlen((char*) outbuf) + 1;
xfree(inbuf); free(inbuf);
return outbuf; return outbuf;
} }
@ -730,7 +730,7 @@ static boolean xf_cliprdr_get_requested_data(xfInfo* xfi, Atom target)
cb->incr_starts = true; cb->incr_starts = true;
if (cb->incr_data) if (cb->incr_data)
{ {
xfree(cb->incr_data); free(cb->incr_data);
cb->incr_data = NULL; cb->incr_data = NULL;
} }
cb->incr_data_length = 0; cb->incr_data_length = 0;
@ -758,7 +758,7 @@ static boolean xf_cliprdr_get_requested_data(xfInfo* xfi, Atom target)
{ {
bytes_left = length * format / 8; bytes_left = length * format / 8;
DEBUG_X11("%d bytes", (int)bytes_left); DEBUG_X11("%d bytes", (int)bytes_left);
cb->incr_data = (uint8*) xrealloc(cb->incr_data, cb->incr_data_length + bytes_left); cb->incr_data = (uint8*) realloc(cb->incr_data, cb->incr_data_length + bytes_left);
memcpy(cb->incr_data + cb->incr_data_length, data, bytes_left); memcpy(cb->incr_data + cb->incr_data_length, data, bytes_left);
cb->incr_data_length += bytes_left; cb->incr_data_length += bytes_left;
XFree(data); XFree(data);
@ -832,12 +832,12 @@ static void xf_cliprdr_process_cb_format_list_event(xfInfo* xfi, RDP_CB_FORMAT_L
if (cb->data) if (cb->data)
{ {
xfree(cb->data); free(cb->data);
cb->data = NULL; cb->data = NULL;
} }
if (cb->formats) if (cb->formats)
xfree(cb->formats); free(cb->formats);
cb->formats = event->formats; cb->formats = event->formats;
cb->num_formats = event->num_formats; cb->num_formats = event->num_formats;
@ -870,7 +870,7 @@ static void xf_cliprdr_process_cb_format_list_event(xfInfo* xfi, RDP_CB_FORMAT_L
static void xf_cliprdr_process_text(clipboardContext* cb, uint8* data, int size) static void xf_cliprdr_process_text(clipboardContext* cb, uint8* data, int size)
{ {
cb->data = (uint8*) xmalloc(size); cb->data = (uint8*) malloc(size);
memcpy(cb->data, data, size); memcpy(cb->data, data, size);
cb->data_length = size; cb->data_length = size;
crlf2lf(cb->data, &cb->data_length); crlf2lf(cb->data, &cb->data_length);
@ -943,7 +943,7 @@ static void xf_cliprdr_process_html(clipboardContext* cb, uint8* data, int size)
return; return;
} }
cb->data = (uint8*) xmalloc(size - start + 1); cb->data = (uint8*) malloc(size - start + 1);
memcpy(cb->data, data + start, end - start); memcpy(cb->data, data + start, end - start);
cb->data_length = end - start; cb->data_length = end - start;
crlf2lf(cb->data, &cb->data_length); crlf2lf(cb->data, &cb->data_length);
@ -969,7 +969,7 @@ static void xf_cliprdr_process_cb_data_response_event(xfInfo* xfi, RDP_CB_DATA_R
{ {
if (cb->data) if (cb->data)
{ {
xfree(cb->data); free(cb->data);
cb->data = NULL; cb->data = NULL;
} }
switch (cb->data_format) switch (cb->data_format)
@ -1009,7 +1009,7 @@ static void xf_cliprdr_process_cb_data_response_event(xfInfo* xfi, RDP_CB_DATA_R
XSendEvent(xfi->display, cb->respond->xselection.requestor, 0, 0, cb->respond); XSendEvent(xfi->display, cb->respond->xselection.requestor, 0, 0, cb->respond);
XFlush(xfi->display); XFlush(xfi->display);
xfree(cb->respond); free(cb->respond);
cb->respond = NULL; cb->respond = NULL;
} }
@ -1149,7 +1149,7 @@ boolean xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent)
*/ */
if (cb->data) if (cb->data)
{ {
xfree(cb->data); free(cb->data);
cb->data = NULL; cb->data = NULL;
} }
@ -1168,7 +1168,7 @@ boolean xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent)
{ {
XSendEvent(xfi->display, xevent->xselectionrequest.requestor, 0, 0, respond); XSendEvent(xfi->display, xevent->xselectionrequest.requestor, 0, 0, respond);
XFlush(xfi->display); XFlush(xfi->display);
xfree(respond); free(respond);
} }
return true; return true;

View File

@ -227,7 +227,7 @@ Pixmap xf_brush_new(xfInfo* xfi, int width, int height, int bpp, uint8* data)
XFree(image); XFree(image);
if (cdata != data) if (cdata != data)
xfree(cdata); free(cdata);
XFreeGC(xfi->display, gc); XFreeGC(xfi->display, gc);
} }
@ -568,7 +568,7 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
XSetForeground(xfi->display, xfi->gc, color); XSetForeground(xfi->display, xfi->gc, color);
npoints = polyline->numPoints + 1; npoints = polyline->numPoints + 1;
points = xmalloc(sizeof(XPoint) * npoints); points = malloc(sizeof(XPoint) * npoints);
points[0].x = polyline->xStart; points[0].x = polyline->xStart;
points[0].y = polyline->yStart; points[0].y = polyline->yStart;
@ -608,7 +608,7 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
} }
XSetFunction(xfi->display, xfi->gc, GXcopy); XSetFunction(xfi->display, xfi->gc, GXcopy);
xfree(points); free(points);
} }
void xf_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt) void xf_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
@ -724,7 +724,7 @@ void xf_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc)
brush_color = freerdp_color_convert_var(polygon_sc->brushColor, ((xfContext*)context)->settings->color_depth, xfi->bpp, xfi->clrconv); brush_color = freerdp_color_convert_var(polygon_sc->brushColor, ((xfContext*)context)->settings->color_depth, xfi->bpp, xfi->clrconv);
npoints = polygon_sc->numPoints + 1; npoints = polygon_sc->numPoints + 1;
points = xmalloc(sizeof(XPoint) * npoints); points = malloc(sizeof(XPoint) * npoints);
points[0].x = polygon_sc->xStart; points[0].x = polygon_sc->xStart;
points[0].y = polygon_sc->yStart; points[0].y = polygon_sc->yStart;
@ -763,7 +763,7 @@ void xf_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc)
} }
XSetFunction(xfi->display, xfi->gc, GXcopy); XSetFunction(xfi->display, xfi->gc, GXcopy);
xfree(points); free(points);
} }
void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb) void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
@ -782,7 +782,7 @@ void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
backColor = freerdp_color_convert_rgb(polygon_cb->backColor, ((xfContext*)context)->settings->color_depth, xfi->bpp, xfi->clrconv); backColor = freerdp_color_convert_rgb(polygon_cb->backColor, ((xfContext*)context)->settings->color_depth, xfi->bpp, xfi->clrconv);
npoints = polygon_cb->numPoints + 1; npoints = polygon_cb->numPoints + 1;
points = xmalloc(sizeof(XPoint) * npoints); points = malloc(sizeof(XPoint) * npoints);
points[0].x = polygon_cb->xStart; points[0].x = polygon_cb->xStart;
points[0].y = polygon_cb->yStart; points[0].y = polygon_cb->yStart;
@ -866,7 +866,7 @@ void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
} }
XSetFunction(xfi->display, xfi->gc, GXcopy); XSetFunction(xfi->display, xfi->gc, GXcopy);
xfree(points); free(points);
} }
void xf_gdi_ellipse_sc(rdpContext* context, ELLIPSE_SC_ORDER* ellipse_sc) void xf_gdi_ellipse_sc(rdpContext* context, ELLIPSE_SC_ORDER* ellipse_sc)
@ -998,7 +998,7 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
XSetFunction(xfi->display, xfi->gc, GXcopy); XSetFunction(xfi->display, xfi->gc, GXcopy);
XSetFillStyle(xfi->display, xfi->gc, FillSolid); XSetFillStyle(xfi->display, xfi->gc, FillSolid);
xfi->bmp_codec_nsc = (uint8*) xrealloc(xfi->bmp_codec_nsc, xfi->bmp_codec_nsc = (uint8*) realloc(xfi->bmp_codec_nsc,
surface_bits_command->width * surface_bits_command->height * 4); surface_bits_command->width * surface_bits_command->height * 4);
freerdp_image_flip(nsc_context->bmpdata, xfi->bmp_codec_nsc, freerdp_image_flip(nsc_context->bmpdata, xfi->bmp_codec_nsc,
@ -1026,7 +1026,7 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
/* Validate that the data received is large enough */ /* Validate that the data received is large enough */
if( surface_bits_command->width * surface_bits_command->height * surface_bits_command->bpp / 8 <= surface_bits_command->bitmapDataLength ) if( surface_bits_command->width * surface_bits_command->height * surface_bits_command->bpp / 8 <= surface_bits_command->bitmapDataLength )
{ {
xfi->bmp_codec_none = (uint8*) xrealloc(xfi->bmp_codec_none, xfi->bmp_codec_none = (uint8*) realloc(xfi->bmp_codec_none,
surface_bits_command->width * surface_bits_command->height * 4); surface_bits_command->width * surface_bits_command->height * 4);
freerdp_image_flip(surface_bits_command->bitmapData, xfi->bmp_codec_none, freerdp_image_flip(surface_bits_command->bitmapData, xfi->bmp_codec_none,

View File

@ -61,12 +61,12 @@ void xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
XFree(image); XFree(image);
if (data != bitmap->data) if (data != bitmap->data)
xfree(data); free(data);
} }
else else
{ {
if (data != bitmap->data) if (data != bitmap->data)
xfree(bitmap->data); free(bitmap->data);
bitmap->data = data; bitmap->data = data;
} }
@ -127,9 +127,9 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
size = width * height * (bpp + 7) / 8; size = width * height * (bpp + 7) / 8;
if (bitmap->data == NULL) if (bitmap->data == NULL)
bitmap->data = (uint8*) xmalloc(size); bitmap->data = (uint8*) malloc(size);
else else
bitmap->data = (uint8*) xrealloc(bitmap->data, size); bitmap->data = (uint8*) realloc(bitmap->data, size);
switch (codec_id) switch (codec_id)
{ {
@ -222,7 +222,7 @@ void xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
} }
((xfPointer*) pointer)->cursor = XcursorImageLoadCursor(xfi->display, &ci); ((xfPointer*) pointer)->cursor = XcursorImageLoadCursor(xfi->display, &ci);
xfree(ci.pixels); free(ci.pixels);
} }
void xf_Pointer_Free(rdpContext* context, rdpPointer* pointer) void xf_Pointer_Free(rdpContext* context, rdpPointer* pointer)
@ -376,7 +376,7 @@ void xf_register_graphics(rdpGraphics* graphics)
bitmap->SetSurface = xf_Bitmap_SetSurface; bitmap->SetSurface = xf_Bitmap_SetSurface;
graphics_register_bitmap(graphics, bitmap); graphics_register_bitmap(graphics, bitmap);
xfree(bitmap); free(bitmap);
pointer = xnew(rdpPointer); pointer = xnew(rdpPointer);
pointer->size = sizeof(xfPointer); pointer->size = sizeof(xfPointer);
@ -388,7 +388,7 @@ void xf_register_graphics(rdpGraphics* graphics)
pointer->SetDefault = xf_Pointer_SetDefault; pointer->SetDefault = xf_Pointer_SetDefault;
graphics_register_pointer(graphics, pointer); graphics_register_pointer(graphics, pointer);
xfree(pointer); free(pointer);
glyph = xnew(rdpGlyph); glyph = xnew(rdpGlyph);
glyph->size = sizeof(xfGlyph); glyph->size = sizeof(xfGlyph);
@ -400,5 +400,5 @@ void xf_register_graphics(rdpGraphics* graphics)
glyph->EndDraw = xf_Glyph_EndDraw; glyph->EndDraw = xf_Glyph_EndDraw;
graphics_register_glyph(graphics, glyph); graphics_register_glyph(graphics, glyph);
xfree(glyph); free(glyph);
} }

View File

@ -172,10 +172,10 @@ void xf_tsmf_uninit(xfInfo* xfi)
} }
if (xv->xv_pixfmts) if (xv->xv_pixfmts)
{ {
xfree(xv->xv_pixfmts); free(xv->xv_pixfmts);
xv->xv_pixfmts = NULL; xv->xv_pixfmts = NULL;
} }
xfree(xv); free(xv);
xfi->xv_context = NULL; xfi->xv_context = NULL;
} }
} }

View File

@ -173,7 +173,7 @@ boolean xf_GetCurrentDesktop(xfInfo* xfi)
} }
xfi->current_desktop = (int) *prop; xfi->current_desktop = (int) *prop;
xfree(prop); free(prop);
return true; return true;
} }
@ -198,7 +198,7 @@ boolean xf_GetWorkArea(xfInfo* xfi)
return false; return false;
if ((xfi->current_desktop * 4 + 3) >= nitems) { if ((xfi->current_desktop * 4 + 3) >= nitems) {
xfree(prop); free(prop);
return false; return false;
} }
@ -208,7 +208,7 @@ boolean xf_GetWorkArea(xfInfo* xfi)
xfi->workArea.y = plong[xfi->current_desktop * 4 + 1]; xfi->workArea.y = plong[xfi->current_desktop * 4 + 1];
xfi->workArea.width = plong[xfi->current_desktop * 4 + 2]; xfi->workArea.width = plong[xfi->current_desktop * 4 + 2];
xfi->workArea.height = plong[xfi->current_desktop * 4 + 3]; xfi->workArea.height = plong[xfi->current_desktop * 4 + 3];
xfree(prop); free(prop);
return true; return true;
} }
@ -511,13 +511,13 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width,
if (class_hints != NULL) if (class_hints != NULL)
{ {
char* class; char* class;
class = xmalloc(sizeof(rail_window_class)); class = malloc(sizeof(rail_window_class));
snprintf(class, sizeof(rail_window_class), "RAIL:%08X", id); snprintf(class, sizeof(rail_window_class), "RAIL:%08X", id);
class_hints->res_name = "RAIL"; class_hints->res_name = "RAIL";
class_hints->res_class = class; class_hints->res_class = class;
XSetClassHint(xfi->display, window->handle, class_hints); XSetClassHint(xfi->display, window->handle, class_hints);
XFree(class_hints); XFree(class_hints);
xfree(class); free(class);
} }
/* Set the input mode hint for the WM */ /* Set the input mode hint for the WM */
@ -761,7 +761,7 @@ void xf_SetWindowIcon(xfInfo* xfi, xfWindow* window, rdpIcon* icon)
pixels = icon->entry->width * icon->entry->height; pixels = icon->entry->width * icon->entry->height;
propsize = 2 + pixels; propsize = 2 + pixels;
propdata = xmalloc(propsize * sizeof(long)); propdata = malloc(propsize * sizeof(long));
propdata[0] = icon->entry->width; propdata[0] = icon->entry->width;
propdata[1] = icon->entry->height; propdata[1] = icon->entry->height;
@ -790,7 +790,7 @@ void xf_SetWindowRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int n
if (nrects == 0) if (nrects == 0)
return; return;
xrects = xmalloc(sizeof(XRectangle) * nrects); xrects = malloc(sizeof(XRectangle) * nrects);
for (i = 0; i < nrects; i++) for (i = 0; i < nrects; i++)
{ {
@ -807,7 +807,7 @@ void xf_SetWindowRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int n
*/ */
#endif #endif
xfree(xrects); free(xrects);
} }
void xf_SetWindowVisibilityRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int nrects) void xf_SetWindowVisibilityRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int nrects)
@ -818,7 +818,7 @@ void xf_SetWindowVisibilityRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* re
if (nrects == 0) if (nrects == 0)
return; return;
xrects = xmalloc(sizeof(XRectangle) * nrects); xrects = malloc(sizeof(XRectangle) * nrects);
for (i = 0; i < nrects; i++) for (i = 0; i < nrects; i++)
{ {
@ -835,7 +835,7 @@ void xf_SetWindowVisibilityRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* re
*/ */
#endif #endif
xfree(xrects); free(xrects);
} }
void xf_UpdateWindowArea(xfInfo* xfi, xfWindow* window, int x, int y, int width, int height) void xf_UpdateWindowArea(xfInfo* xfi, xfWindow* window, int x, int y, int width, int height)
@ -917,7 +917,7 @@ void xf_DestroyWindow(xfInfo* xfi, xfWindow* window)
XDestroyWindow(xfi->display, window->handle); XDestroyWindow(xfi->display, window->handle);
} }
xfree(window); free(window);
} }
rdpWindow* xf_rdpWindowFromWindow(xfInfo* xfi, Window wnd) rdpWindow* xf_rdpWindowFromWindow(xfInfo* xfi, Window wnd)

View File

@ -314,17 +314,17 @@ void xf_create_window(xfInfo* xfi)
} }
else if (xfi->instance->settings->port == 3389) else if (xfi->instance->settings->port == 3389)
{ {
win_title = xmalloc(1 + sizeof("FreeRDP: ") + strlen(xfi->instance->settings->hostname)); win_title = malloc(1 + sizeof("FreeRDP: ") + strlen(xfi->instance->settings->hostname));
sprintf(win_title, "FreeRDP: %s", xfi->instance->settings->hostname); sprintf(win_title, "FreeRDP: %s", xfi->instance->settings->hostname);
} }
else else
{ {
win_title = xmalloc(1 + sizeof("FreeRDP: ") + strlen(xfi->instance->settings->hostname) + sizeof(":00000")); win_title = malloc(1 + sizeof("FreeRDP: ") + strlen(xfi->instance->settings->hostname) + sizeof(":00000"));
sprintf(win_title, "FreeRDP: %s:%i", xfi->instance->settings->hostname, xfi->instance->settings->port); sprintf(win_title, "FreeRDP: %s:%i", xfi->instance->settings->hostname, xfi->instance->settings->port);
} }
xfi->window = xf_CreateDesktopWindow(xfi, win_title, width, height, xfi->decorations); xfi->window = xf_CreateDesktopWindow(xfi, win_title, width, height, xfi->decorations);
xfree(win_title); free(win_title);
if (xfi->fullscreen) if (xfi->fullscreen)
xf_SetWindowFullscreen(xfi, xfi->window, xfi->fullscreen); xf_SetWindowFullscreen(xfi, xfi->window, xfi->fullscreen);
@ -758,7 +758,7 @@ boolean xf_post_connect(freerdp* instance)
xfi->image = XCreateImage(xfi->display, xfi->visual, xfi->depth, ZPixmap, 0, xfi->image = XCreateImage(xfi->display, xfi->visual, xfi->depth, ZPixmap, 0,
(char*) xfi->primary_buffer, xfi->width, xfi->height, xfi->scanline_pad, 0); (char*) xfi->primary_buffer, xfi->width, xfi->height, xfi->scanline_pad, 0);
xfi->bmp_codec_none = (uint8*) xmalloc(64 * 64 * 4); xfi->bmp_codec_none = (uint8*) malloc(64 * 64 * 4);
if (xfi->sw_gdi) if (xfi->sw_gdi)
{ {
@ -805,7 +805,7 @@ boolean xf_post_connect(freerdp* instance)
* @param username - unused * @param username - unused
* @param password - on return: pointer to a character string that will be filled by the password entered by the user. * @param password - on return: pointer to a character string that will be filled by the password entered by the user.
* Note that this character string will be allocated inside the function, and needs to be deallocated by the caller * Note that this character string will be allocated inside the function, and needs to be deallocated by the caller
* using xfree(), even in case this function fails. * using free(), even in case this function fails.
* @param domain - unused * @param domain - unused
* @return true if a password was successfully entered. See freerdp_passphrase_read() for more details. * @return true if a password was successfully entered. See freerdp_passphrase_read() for more details.
*/ */
@ -813,7 +813,7 @@ boolean xf_authenticate(freerdp* instance, char** username, char** password, cha
{ {
// FIXME: seems this callback may be called when 'username' is not known. // FIXME: seems this callback may be called when 'username' is not known.
// But it doesn't do anything to fix it... // But it doesn't do anything to fix it...
*password = xmalloc(password_size * sizeof(char)); *password = malloc(password_size * sizeof(char));
if (freerdp_passphrase_read("Password: ", *password, password_size, instance->settings->from_stdin) == NULL) if (freerdp_passphrase_read("Password: ", *password, password_size, instance->settings->from_stdin) == NULL)
return false; return false;
@ -891,9 +891,9 @@ int xf_process_client_args(rdpSettings* settings, const char* opt, const char* v
for (i = 0; layouts[i].code; i++) for (i = 0; layouts[i].code; i++)
{ {
printf("0x%08X\t%s\n", layouts[i].code, layouts[i].name); printf("0x%08X\t%s\n", layouts[i].code, layouts[i].name);
xfree(layouts[i].name); free(layouts[i].name);
} }
xfree(layouts); free(layouts);
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_VARIANT); layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_VARIANT);
@ -901,9 +901,9 @@ int xf_process_client_args(rdpSettings* settings, const char* opt, const char* v
for (i = 0; layouts[i].code; i++) for (i = 0; layouts[i].code; i++)
{ {
printf("0x%08X\t%s\n", layouts[i].code, layouts[i].name); printf("0x%08X\t%s\n", layouts[i].code, layouts[i].name);
xfree(layouts[i].name); free(layouts[i].name);
} }
xfree(layouts); free(layouts);
layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_IME); layouts = freerdp_keyboard_get_layouts(RDP_KEYBOARD_LAYOUT_TYPE_IME);
@ -911,9 +911,9 @@ int xf_process_client_args(rdpSettings* settings, const char* opt, const char* v
for (i = 0; layouts[i].code; i++) for (i = 0; layouts[i].code; i++)
{ {
printf("0x%08X\t%s\n", layouts[i].code, layouts[i].name); printf("0x%08X\t%s\n", layouts[i].code, layouts[i].name);
xfree(layouts[i].name); free(layouts[i].name);
} }
xfree(layouts); free(layouts);
exit(0); exit(0);
} }
@ -1081,11 +1081,11 @@ void xf_free(xfInfo* xfi)
{ {
xf_window_free(xfi); xf_window_free(xfi);
xfree(xfi->bmp_codec_none); free(xfi->bmp_codec_none);
XCloseDisplay(xfi->display); XCloseDisplay(xfi->display);
xfree(xfi); free(xfi);
} }
/** Main loop for the rdp connection. /** Main loop for the rdp connection.
@ -1261,7 +1261,7 @@ void* thread_func(void* param)
g_disconnect_reason = xfreerdp_run(data->instance); g_disconnect_reason = xfreerdp_run(data->instance);
xfree(data); free(data);
g_thread_count--; g_thread_count--;

View File

@ -143,7 +143,7 @@ void test_cliprdr(void)
event = freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_FORMAT_LIST, event_process_callback, NULL); event = freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_FORMAT_LIST, event_process_callback, NULL);
format_list_event = (RDP_CB_FORMAT_LIST_EVENT*) event; format_list_event = (RDP_CB_FORMAT_LIST_EVENT*) event;
format_list_event->num_formats = 2; format_list_event->num_formats = 2;
format_list_event->formats = (uint32*) xmalloc(sizeof(uint32) * 2); format_list_event->formats = (uint32*) malloc(sizeof(uint32) * 2);
format_list_event->formats[0] = CB_FORMAT_TEXT; format_list_event->formats[0] = CB_FORMAT_TEXT;
format_list_event->formats[1] = CB_FORMAT_HTML; format_list_event->formats[1] = CB_FORMAT_HTML;
event_processed = 0; event_processed = 0;
@ -199,7 +199,7 @@ void test_cliprdr(void)
/* UI sends data response event to cliprdr */ /* UI sends data response event to cliprdr */
event = freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_DATA_RESPONSE, event_process_callback, NULL); event = freerdp_event_new(RDP_EVENT_CLASS_CLIPRDR, RDP_EVENT_TYPE_CB_DATA_RESPONSE, event_process_callback, NULL);
data_response_event = (RDP_CB_DATA_RESPONSE_EVENT*)event; data_response_event = (RDP_CB_DATA_RESPONSE_EVENT*)event;
data_response_event->data = (uint8*)xmalloc(6); data_response_event->data = (uint8*)malloc(6);
strcpy((char*)data_response_event->data, "hello"); strcpy((char*)data_response_event->data, "hello");
data_response_event->size = 6; data_response_event->size = 6;
event_processed = 0; event_processed = 0;

View File

@ -483,7 +483,7 @@ void test_license_decrypt_platform_challenge(void)
sizeof(test_licensing_encryption_key)); sizeof(test_licensing_encryption_key));
license->encrypted_platform_challenge->data = license->encrypted_platform_challenge->data =
(uint8*) xmalloc(sizeof(test_encrypted_platform_challenge)); (uint8*) malloc(sizeof(test_encrypted_platform_challenge));
license->encrypted_platform_challenge->length = license->encrypted_platform_challenge->length =
sizeof(test_encrypted_platform_challenge); sizeof(test_encrypted_platform_challenge);

View File

@ -199,7 +199,7 @@ void test_bitstream(void)
(void) b; (void) b;
//printf("%u ", b); //printf("%u ", b);
} }
xfree(bs); free(bs);
//printf("\n"); //printf("\n");
} }
@ -221,7 +221,7 @@ void test_bitstream_enc(void)
{ {
printf("%X ", buffer[i]); printf("%X ", buffer[i]);
}*/ }*/
xfree(bs); free(bs);
//printf("\n"); //printf("\n");
} }

View File

@ -25,10 +25,8 @@
#include <wchar.h> #include <wchar.h>
#include <freerdp/api.h> #include <freerdp/api.h>
FREERDP_API void* xmalloc(size_t size);
FREERDP_API void* xzalloc(size_t size); FREERDP_API void* xzalloc(size_t size);
FREERDP_API void* xrealloc(void* ptr, size_t size);
FREERDP_API void xfree(void* ptr);
FREERDP_API char* xstrdup(const char* str); FREERDP_API char* xstrdup(const char* str);
FREERDP_API char* xstrtoup(const char* str); FREERDP_API char* xstrtoup(const char* str);
FREERDP_API wchar_t* xwcsdup(const wchar_t* wstr); FREERDP_API wchar_t* xwcsdup(const wchar_t* wstr);

View File

@ -327,13 +327,13 @@ void bitmap_cache_free(rdpBitmapCache* bitmap_cache)
} }
} }
xfree(bitmap_cache->cells[i].entries); free(bitmap_cache->cells[i].entries);
} }
if (bitmap_cache->bitmap != NULL) if (bitmap_cache->bitmap != NULL)
Bitmap_Free(bitmap_cache->context, bitmap_cache->bitmap); Bitmap_Free(bitmap_cache->context, bitmap_cache->bitmap);
xfree(bitmap_cache->cells); free(bitmap_cache->cells);
xfree(bitmap_cache); free(bitmap_cache);
} }
} }

View File

@ -129,7 +129,7 @@ void brush_cache_put(rdpBrushCache* brush, uint32 index, void* entry, uint32 bpp
prevEntry = brush->monoEntries[index].entry; prevEntry = brush->monoEntries[index].entry;
if (prevEntry != NULL) if (prevEntry != NULL)
xfree(prevEntry); free(prevEntry);
brush->monoEntries[index].bpp = bpp; brush->monoEntries[index].bpp = bpp;
brush->monoEntries[index].entry = entry; brush->monoEntries[index].entry = entry;
@ -145,7 +145,7 @@ void brush_cache_put(rdpBrushCache* brush, uint32 index, void* entry, uint32 bpp
prevEntry = brush->entries[index].entry; prevEntry = brush->entries[index].entry;
if (prevEntry != NULL) if (prevEntry != NULL)
xfree(prevEntry); free(prevEntry);
brush->entries[index].bpp = bpp; brush->entries[index].bpp = bpp;
brush->entries[index].entry = entry; brush->entries[index].entry = entry;
@ -197,10 +197,10 @@ void brush_cache_free(rdpBrushCache* brush)
for (i = 0; i < (int) brush->maxEntries; i++) for (i = 0; i < (int) brush->maxEntries; i++)
{ {
if (brush->entries[i].entry != NULL) if (brush->entries[i].entry != NULL)
xfree(brush->entries[i].entry); free(brush->entries[i].entry);
} }
xfree(brush->entries); free(brush->entries);
} }
if (brush->monoEntries != NULL) if (brush->monoEntries != NULL)
@ -208,12 +208,12 @@ void brush_cache_free(rdpBrushCache* brush)
for (i = 0; i < (int) brush->maxMonoEntries; i++) for (i = 0; i < (int) brush->maxMonoEntries; i++)
{ {
if (brush->monoEntries[i].entry != NULL) if (brush->monoEntries[i].entry != NULL)
xfree(brush->monoEntries[i].entry); free(brush->monoEntries[i].entry);
} }
xfree(brush->monoEntries); free(brush->monoEntries);
} }
xfree(brush); free(brush);
} }
} }

View File

@ -58,6 +58,6 @@ void cache_free(rdpCache* cache)
offscreen_cache_free(cache->offscreen); offscreen_cache_free(cache->offscreen);
palette_cache_free(cache->palette); palette_cache_free(cache->palette);
nine_grid_cache_free(cache->nine_grid); nine_grid_cache_free(cache->nine_grid);
xfree(cache); free(cache);
} }
} }

View File

@ -143,7 +143,7 @@ void update_process_glyph_fragments(rdpContext* context, uint8* data, uint32 len
id = data[index + 1]; id = data[index + 1];
size = data[index + 2]; size = data[index + 2];
fragments = (uint8*) xmalloc(size); fragments = (uint8*) malloc(size);
memcpy(fragments, data, size); memcpy(fragments, data, size);
glyph_cache_fragment_put(glyph_cache, id, size, fragments); glyph_cache_fragment_put(glyph_cache, id, size, fragments);
@ -286,7 +286,7 @@ void update_gdi_fast_glyph(rdpContext* context, FAST_GLYPH_ORDER* fast_glyph)
glyph->cb = glyph_data->cb; glyph->cb = glyph_data->cb;
Glyph_New(context, glyph); Glyph_New(context, glyph);
glyph_cache_put(cache->glyph, fast_glyph->cacheId, fast_glyph->data[0], glyph); glyph_cache_put(cache->glyph, fast_glyph->cacheId, fast_glyph->data[0], glyph);
xfree(fast_glyph->glyph_data); free(fast_glyph->glyph_data);
fast_glyph->glyph_data = NULL; fast_glyph->glyph_data = NULL;
} }
@ -326,7 +326,7 @@ void update_gdi_cache_glyph(rdpContext* context, CACHE_GLYPH_ORDER* cache_glyph)
glyph_cache_put(cache->glyph, cache_glyph->cacheId, glyph_data->cacheIndex, glyph); glyph_cache_put(cache->glyph, cache_glyph->cacheId, glyph_data->cacheIndex, glyph);
cache_glyph->glyphData[i] = NULL; cache_glyph->glyphData[i] = NULL;
xfree(glyph_data); free(glyph_data);
} }
} }
@ -354,7 +354,7 @@ void update_gdi_cache_glyph_v2(rdpContext* context, CACHE_GLYPH_V2_ORDER* cache_
glyph_cache_put(cache->glyph, cache_glyph_v2->cacheId, glyph_data->cacheIndex, glyph); glyph_cache_put(cache->glyph, cache_glyph_v2->cacheId, glyph_data->cacheIndex, glyph);
cache_glyph_v2->glyphData[i] = NULL; cache_glyph_v2->glyphData[i] = NULL;
xfree(glyph_data); free(glyph_data);
} }
} }
@ -405,8 +405,8 @@ void glyph_cache_put(rdpGlyphCache* glyph_cache, uint32 id, uint32 index, rdpGly
if (prevGlyph != NULL) if (prevGlyph != NULL)
{ {
Glyph_Free(glyph_cache->context, prevGlyph); Glyph_Free(glyph_cache->context, prevGlyph);
xfree(prevGlyph->aj); free(prevGlyph->aj);
xfree(prevGlyph); free(prevGlyph);
} }
glyph_cache->glyphCache[id].entries[index] = glyph; glyph_cache->glyphCache[id].entries[index] = glyph;
@ -438,7 +438,7 @@ void glyph_cache_fragment_put(rdpGlyphCache* glyph_cache, uint32 index, uint32 s
if (prevFragment != NULL) if (prevFragment != NULL)
{ {
xfree(prevFragment); free(prevFragment);
} }
} }
@ -500,20 +500,20 @@ void glyph_cache_free(rdpGlyphCache* glyph_cache)
if (glyph != NULL) if (glyph != NULL)
{ {
Glyph_Free(glyph_cache->context, glyph); Glyph_Free(glyph_cache->context, glyph);
xfree(glyph->aj); free(glyph->aj);
xfree(glyph); free(glyph);
} }
} }
xfree(glyph_cache->glyphCache[i].entries); free(glyph_cache->glyphCache[i].entries);
} }
for (i = 0; i < 255; i++) for (i = 0; i < 255; i++)
{ {
fragment = glyph_cache->fragCache.entries[i].fragment; fragment = glyph_cache->fragCache.entries[i].fragment;
xfree(fragment); free(fragment);
} }
xfree(glyph_cache->fragCache.entries); free(glyph_cache->fragCache.entries);
xfree(glyph_cache); free(glyph_cache);
} }
} }

View File

@ -87,7 +87,7 @@ void nine_grid_cache_put(rdpNineGridCache* nine_grid, uint32 index, void* entry)
prevEntry = nine_grid->entries[index].entry; prevEntry = nine_grid->entries[index].entry;
if (prevEntry != NULL) if (prevEntry != NULL)
xfree(prevEntry); free(prevEntry);
nine_grid->entries[index].entry = entry; nine_grid->entries[index].entry = entry;
} }
@ -125,12 +125,12 @@ void nine_grid_cache_free(rdpNineGridCache* nine_grid)
for (i = 0; i < (int) nine_grid->maxEntries; i++) for (i = 0; i < (int) nine_grid->maxEntries; i++)
{ {
if (nine_grid->entries[i].entry != NULL) if (nine_grid->entries[i].entry != NULL)
xfree(nine_grid->entries[i].entry); free(nine_grid->entries[i].entry);
} }
xfree(nine_grid->entries); free(nine_grid->entries);
} }
xfree(nine_grid); free(nine_grid);
} }
} }

View File

@ -169,7 +169,7 @@ void offscreen_cache_free(rdpOffscreenCache* offscreen_cache)
Bitmap_Free(offscreen_cache->update->context, bitmap); Bitmap_Free(offscreen_cache->update->context, bitmap);
} }
xfree(offscreen_cache->entries); free(offscreen_cache->entries);
xfree(offscreen_cache); free(offscreen_cache);
} }
} }

View File

@ -91,8 +91,8 @@ void palette_cache_free(rdpPaletteCache* palette_cache)
{ {
if (palette_cache != NULL) if (palette_cache != NULL)
{ {
xfree(palette_cache->entries); free(palette_cache->entries);
xfree(palette_cache); free(palette_cache);
} }
} }

View File

@ -187,7 +187,7 @@ void pointer_cache_free(rdpPointerCache* pointer_cache)
Pointer_Free(pointer_cache->update->context, pointer); Pointer_Free(pointer_cache->update->context, pointer);
} }
xfree(pointer_cache->entries); free(pointer_cache->entries);
xfree(pointer_cache); free(pointer_cache);
} }
} }

View File

@ -663,12 +663,12 @@ void freerdp_channels_free(rdpChannels* channels)
prev->next = list->next; prev->next = list->next;
else else
g_channels_list = list->next; g_channels_list = list->next;
xfree(list); free(list);
} }
ReleaseMutex(g_mutex_list); ReleaseMutex(g_mutex_list);
xfree(channels); free(channels);
} }
int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, void* entry, void* data) int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, void* entry, void* data)

View File

@ -47,8 +47,8 @@ typedef struct wts_data_item
static void wts_data_item_free(wts_data_item* item) static void wts_data_item_free(wts_data_item* item)
{ {
xfree(item->buffer); free(item->buffer);
xfree(item); free(item);
} }
static rdpPeerChannel* wts_get_dvc_channel_by_id(WTSVirtualChannelManager* vcm, uint32 ChannelId) static rdpPeerChannel* wts_get_dvc_channel_by_id(WTSVirtualChannelManager* vcm, uint32 ChannelId)
@ -73,7 +73,7 @@ static void wts_queue_receive_data(rdpPeerChannel* channel, const uint8* buffer,
item = xnew(wts_data_item); item = xnew(wts_data_item);
item->length = length; item->length = length;
item->buffer = xmalloc(length); item->buffer = malloc(length);
memcpy(item->buffer, buffer, length); memcpy(item->buffer, buffer, length);
WaitForSingleObject(channel->mutex, INFINITE); WaitForSingleObject(channel->mutex, INFINITE);
@ -429,7 +429,7 @@ void WTSDestroyVirtualChannelManager(WTSVirtualChannelManager* vcm)
list_free(vcm->send_queue); list_free(vcm->send_queue);
CloseHandle(vcm->mutex); CloseHandle(vcm->mutex);
xfree(vcm); free(vcm);
} }
} }
@ -585,7 +585,7 @@ boolean WTSVirtualChannelQuery(
{ {
case WTSVirtualFileHandle: case WTSVirtualFileHandle:
wait_obj_get_fds(channel->receive_event, fds, &fds_count); wait_obj_get_fds(channel->receive_event, fds, &fds_count);
*ppBuffer = xmalloc(sizeof(void*)); *ppBuffer = malloc(sizeof(void*));
memcpy(*ppBuffer, &fds[0], sizeof(void*)); memcpy(*ppBuffer, &fds[0], sizeof(void*));
*pBytesReturned = sizeof(void*); *pBytesReturned = sizeof(void*);
result = true; result = true;
@ -615,7 +615,7 @@ boolean WTSVirtualChannelQuery(
break; break;
} }
} }
*ppBuffer = xmalloc(sizeof(boolean)); *ppBuffer = malloc(sizeof(boolean));
memcpy(*ppBuffer, &bval, sizeof(boolean)); memcpy(*ppBuffer, &bval, sizeof(boolean));
*pBytesReturned = sizeof(boolean); *pBytesReturned = sizeof(boolean);
break; break;
@ -629,7 +629,7 @@ boolean WTSVirtualChannelQuery(
void WTSFreeMemory( void WTSFreeMemory(
/* __in */ void* pMemory) /* __in */ void* pMemory)
{ {
xfree(pMemory); free(pMemory);
} }
boolean WTSVirtualChannelRead( boolean WTSVirtualChannelRead(
@ -691,7 +691,7 @@ boolean WTSVirtualChannelWrite(
if (channel->channel_type == RDP_PEER_CHANNEL_TYPE_SVC) if (channel->channel_type == RDP_PEER_CHANNEL_TYPE_SVC)
{ {
item = xnew(wts_data_item); item = xnew(wts_data_item);
item->buffer = xmalloc(Length); item->buffer = malloc(Length);
item->length = Length; item->length = Length;
memcpy(item->buffer, Buffer, Length); memcpy(item->buffer, Buffer, Length);
@ -710,7 +710,7 @@ boolean WTSVirtualChannelWrite(
while (Length > 0) while (Length > 0)
{ {
item = xnew(wts_data_item); item = xnew(wts_data_item);
item->buffer = xmalloc(channel->client->settings->vc_chunk_size); item->buffer = malloc(channel->client->settings->vc_chunk_size);
stream_attach(s, item->buffer, channel->client->settings->vc_chunk_size); stream_attach(s, item->buffer, channel->client->settings->vc_chunk_size);
stream_seek_uint8(s); stream_seek_uint8(s);
@ -800,7 +800,7 @@ boolean WTSVirtualChannelClose(
if (channel->mutex) if (channel->mutex)
CloseHandle(channel->mutex); CloseHandle(channel->mutex);
xfree(channel); free(channel);
} }
return true; return true;

View File

@ -445,10 +445,10 @@ boolean bitmap_decompress(uint8* srcData, uint8* dstData, int width, int height,
if (srcBpp == 16 && dstBpp == 16) if (srcBpp == 16 && dstBpp == 16)
{ {
TmpBfr = (uint8*) xmalloc(width * height * 2); TmpBfr = (uint8*) malloc(width * height * 2);
RleDecompress16to16(srcData, size, TmpBfr, width * 2, width, height); RleDecompress16to16(srcData, size, TmpBfr, width * 2, width, height);
freerdp_bitmap_flip(TmpBfr, dstData, width * 2, height); freerdp_bitmap_flip(TmpBfr, dstData, width * 2, height);
xfree(TmpBfr); free(TmpBfr);
} }
else if (srcBpp == 32 && dstBpp == 32) else if (srcBpp == 32 && dstBpp == 32)
{ {
@ -457,24 +457,24 @@ boolean bitmap_decompress(uint8* srcData, uint8* dstData, int width, int height,
} }
else if (srcBpp == 15 && dstBpp == 15) else if (srcBpp == 15 && dstBpp == 15)
{ {
TmpBfr = (uint8*) xmalloc(width * height * 2); TmpBfr = (uint8*) malloc(width * height * 2);
RleDecompress16to16(srcData, size, TmpBfr, width * 2, width, height); RleDecompress16to16(srcData, size, TmpBfr, width * 2, width, height);
freerdp_bitmap_flip(TmpBfr, dstData, width * 2, height); freerdp_bitmap_flip(TmpBfr, dstData, width * 2, height);
xfree(TmpBfr); free(TmpBfr);
} }
else if (srcBpp == 8 && dstBpp == 8) else if (srcBpp == 8 && dstBpp == 8)
{ {
TmpBfr = (uint8*) xmalloc(width * height); TmpBfr = (uint8*) malloc(width * height);
RleDecompress8to8(srcData, size, TmpBfr, width, width, height); RleDecompress8to8(srcData, size, TmpBfr, width, width, height);
freerdp_bitmap_flip(TmpBfr, dstData, width, height); freerdp_bitmap_flip(TmpBfr, dstData, width, height);
xfree(TmpBfr); free(TmpBfr);
} }
else if (srcBpp == 24 && dstBpp == 24) else if (srcBpp == 24 && dstBpp == 24)
{ {
TmpBfr = (uint8*) xmalloc(width * height * 3); TmpBfr = (uint8*) malloc(width * height * 3);
RleDecompress24to24(srcData, size, TmpBfr, width * 3, width, height); RleDecompress24to24(srcData, size, TmpBfr, width * 3, width, height);
freerdp_bitmap_flip(TmpBfr, dstData, width * 3, height); freerdp_bitmap_flip(TmpBfr, dstData, width * 3, height);
xfree(TmpBfr); free(TmpBfr);
} }
else else
{ {

View File

@ -369,7 +369,7 @@ uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int
if (dstBpp == 8) if (dstBpp == 8)
{ {
if (dstData == NULL) if (dstData == NULL)
dstData = (uint8*) xmalloc(width * height); dstData = (uint8*) malloc(width * height);
memcpy(dstData, srcData, width * height); memcpy(dstData, srcData, width * height);
return dstData; return dstData;
@ -377,7 +377,7 @@ uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int
else if (dstBpp == 15 || (dstBpp == 16 && clrconv->rgb555)) else if (dstBpp == 15 || (dstBpp == 16 && clrconv->rgb555))
{ {
if (dstData == NULL) if (dstData == NULL)
dstData = (uint8*) xmalloc(width * height * 2); dstData = (uint8*) malloc(width * height * 2);
dst16 = (uint16 *) dstData; dst16 = (uint16 *) dstData;
for (i = width * height; i > 0; i--) for (i = width * height; i > 0; i--)
@ -396,7 +396,7 @@ uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int
else if (dstBpp == 16) else if (dstBpp == 16)
{ {
if (dstData == NULL) if (dstData == NULL)
dstData = (uint8*) xmalloc(width * height * 2); dstData = (uint8*) malloc(width * height * 2);
dst16 = (uint16 *) dstData; dst16 = (uint16 *) dstData;
for (i = width * height; i > 0; i--) for (i = width * height; i > 0; i--)
@ -415,7 +415,7 @@ uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int
else if (dstBpp == 32) else if (dstBpp == 32)
{ {
if (dstData == NULL) if (dstData == NULL)
dstData = (uint8*) xmalloc(width * height * 4); dstData = (uint8*) malloc(width * height * 4);
src8 = (uint8*) srcData; src8 = (uint8*) srcData;
dst32 = (uint32*) dstData; dst32 = (uint32*) dstData;
@ -450,7 +450,7 @@ uint8* freerdp_image_convert_15bpp(uint8* srcData, uint8* dstData, int width, in
if (dstBpp == 15 || (dstBpp == 16 && clrconv->rgb555)) if (dstBpp == 15 || (dstBpp == 16 && clrconv->rgb555))
{ {
if (dstData == NULL) if (dstData == NULL)
dstData = (uint8*) xmalloc(width * height * 2); dstData = (uint8*) malloc(width * height * 2);
memcpy(dstData, srcData, width * height * 2); memcpy(dstData, srcData, width * height * 2);
@ -459,7 +459,7 @@ uint8* freerdp_image_convert_15bpp(uint8* srcData, uint8* dstData, int width, in
else if (dstBpp == 32) else if (dstBpp == 32)
{ {
if (dstData == NULL) if (dstData == NULL)
dstData = (uint8*) xmalloc(width * height * 4); dstData = (uint8*) malloc(width * height * 4);
src16 = (uint16 *) srcData; src16 = (uint16 *) srcData;
dst32 = (uint32 *) dstData; dst32 = (uint32 *) dstData;
@ -477,7 +477,7 @@ uint8* freerdp_image_convert_15bpp(uint8* srcData, uint8* dstData, int width, in
else if (dstBpp == 16) else if (dstBpp == 16)
{ {
if (dstData == NULL) if (dstData == NULL)
dstData = (uint8*) xmalloc(width * height * 2); dstData = (uint8*) malloc(width * height * 2);
src16 = (uint16 *) srcData; src16 = (uint16 *) srcData;
dst16 = (uint16 *) dstData; dst16 = (uint16 *) dstData;
@ -505,7 +505,7 @@ uint8* freerdp_image_convert_16bpp(uint8* srcData, uint8* dstData, int width, in
if (dstBpp == 16) if (dstBpp == 16)
{ {
if (dstData == NULL) if (dstData == NULL)
dstData = (uint8*) xmalloc(width * height * 2); dstData = (uint8*) malloc(width * height * 2);
if (clrconv->rgb555) if (clrconv->rgb555)
{ {
@ -538,7 +538,7 @@ uint8* freerdp_image_convert_16bpp(uint8* srcData, uint8* dstData, int width, in
uint8 red, green, blue; uint8 red, green, blue;
if (dstData == NULL) if (dstData == NULL)
dstData = (uint8*) xmalloc(width * height * 3); dstData = (uint8*) malloc(width * height * 3);
dst8 = (uint8*) dstData; dst8 = (uint8*) dstData;
src16 = (uint16*) srcData; src16 = (uint16*) srcData;
@ -572,7 +572,7 @@ uint8* freerdp_image_convert_16bpp(uint8* srcData, uint8* dstData, int width, in
uint8 red, green, blue; uint8 red, green, blue;
if (dstData == NULL) if (dstData == NULL)
dstData = (uint8*) xmalloc(width * height * 4); dstData = (uint8*) malloc(width * height * 4);
src16 = (uint16*) srcData; src16 = (uint16*) srcData;
dst32 = (uint32*) dstData; dst32 = (uint32*) dstData;
@ -600,7 +600,7 @@ uint8* freerdp_image_convert_24bpp(uint8* srcData, uint8* dstData, int width, in
{ {
uint8 *dstp; uint8 *dstp;
if (dstData == NULL) if (dstData == NULL)
dstData = (uint8*) xmalloc(width * height * 4); dstData = (uint8*) malloc(width * height * 4);
dstp = dstData; dstp = dstData;
for (i = width * height; i > 0; i--) for (i = width * height; i > 0; i--)
@ -626,7 +626,7 @@ uint8* freerdp_image_convert_32bpp(uint8* srcData, uint8* dstData, int width, in
uint8 red, green, blue; uint8 red, green, blue;
if (dstData == NULL) if (dstData == NULL)
dstData = (uint8*) xmalloc(width * height * 2); dstData = (uint8*) malloc(width * height * 2);
dst16 = (uint16*) dstData; dst16 = (uint16*) dstData;
src32 = (uint32*) srcData; src32 = (uint32*) srcData;
@ -647,7 +647,7 @@ uint8* freerdp_image_convert_32bpp(uint8* srcData, uint8* dstData, int width, in
uint8 red, green, blue; uint8 red, green, blue;
if (dstData == NULL) if (dstData == NULL)
dstData = (uint8*) xmalloc(width * height * 3); dstData = (uint8*) malloc(width * height * 3);
dstp = dstData; dstp = dstData;
for (index = 0; index < width * height; index++) for (index = 0; index < width * height; index++)
@ -681,7 +681,7 @@ uint8* freerdp_image_convert_32bpp(uint8* srcData, uint8* dstData, int width, in
uint8 *dstp; uint8 *dstp;
if (dstData == NULL) if (dstData == NULL)
dstData = (uint8*) xmalloc(width * height * 4); dstData = (uint8*) malloc(width * height * 4);
memcpy(dstData, srcData, width * height * 4); memcpy(dstData, srcData, width * height * 4);
@ -699,7 +699,7 @@ uint8* freerdp_image_convert_32bpp(uint8* srcData, uint8* dstData, int width, in
else else
{ {
if (dstData == NULL) if (dstData == NULL)
dstData = (uint8*) xmalloc(width * height * 4); dstData = (uint8*) malloc(width * height * 4);
memcpy(dstData, srcData, width * height * 4); memcpy(dstData, srcData, width * height * 4);
} }
@ -740,12 +740,12 @@ void freerdp_bitmap_flip(uint8 * src, uint8 * dst, int scanLineSz, int height)
if (src == dst) if (src == dst)
{ {
/* Allocate a scanline buffer. /* Allocate a scanline buffer.
* (FIXME: xmalloc / xfree below should be replaced by "get/put * (FIXME: malloc / xfree below should be replaced by "get/put
* scanline buffer from a pool/Q of fixed buffers" to reuse * scanline buffer from a pool/Q of fixed buffers" to reuse
* fixed size buffers (of max scanline size (or adaptative?) ) * fixed size buffers (of max scanline size (or adaptative?) )
* -- would be much faster). * -- would be much faster).
*/ */
uint8 * tmpBfr = xmalloc(scanLineSz); uint8 * tmpBfr = malloc(scanLineSz);
int half = height / 2; int half = height / 2;
/* Flip buffer in place by line permutations through the temp /* Flip buffer in place by line permutations through the temp
* scan line buffer. * scan line buffer.
@ -765,7 +765,7 @@ void freerdp_bitmap_flip(uint8 * src, uint8 * dst, int scanLineSz, int height)
bottomLine -= scanLineSz; bottomLine -= scanLineSz;
height--; height--;
} }
xfree(tmpBfr); free(tmpBfr);
} }
/* Flip from source buffer to destination buffer. */ /* Flip from source buffer to destination buffer. */
else else
@ -788,7 +788,7 @@ uint8* freerdp_image_flip(uint8* srcData, uint8* dstData, int width, int height,
scanline = width * ((bpp + 7) / 8); scanline = width * ((bpp + 7) / 8);
if (dstData == NULL) if (dstData == NULL)
dstData = (uint8*) xmalloc(width * height * ((bpp + 7) / 8)); dstData = (uint8*) malloc(width * height * ((bpp + 7) / 8));
freerdp_bitmap_flip(srcData, dstData, scanline, height); freerdp_bitmap_flip(srcData, dstData, scanline, height);
return dstData; return dstData;
@ -862,7 +862,7 @@ uint8* freerdp_glyph_convert(int width, int height, uint8* data)
*/ */
scanline = (width + 7) / 8; scanline = (width + 7) / 8;
dstData = (uint8*) xmalloc(width * height); dstData = (uint8*) malloc(width * height);
memset(dstData, 0, width * height); memset(dstData, 0, width * height);
dstp = dstData; dstp = dstData;
@ -946,7 +946,7 @@ uint8* freerdp_mono_image_convert(uint8* srcData, int width, int height, int src
} }
} }
dstData = (uint8*) xmalloc(width * height * 2); dstData = (uint8*) malloc(width * height * 2);
dst16 = (uint16*) dstData; dst16 = (uint16*) dstData;
for (index = height; index > 0; index--) for (index = height; index > 0; index--)
@ -971,7 +971,7 @@ uint8* freerdp_mono_image_convert(uint8* srcData, int width, int height, int src
} }
else if (dstBpp == 32) else if (dstBpp == 32)
{ {
dstData = (uint8*) xmalloc(width * height * 4); dstData = (uint8*) malloc(width * height * 4);
dst32 = (uint32*) dstData; dst32 = (uint32*) dstData;
for (index = height; index > 0; index--) for (index = height; index > 0; index--)
@ -1070,8 +1070,8 @@ void freerdp_clrconv_free(HCLRCONV clrconv)
if (clrconv != NULL) if (clrconv != NULL)
{ {
if (clrconv->palette != NULL) if (clrconv->palette != NULL)
xfree(clrconv->palette); free(clrconv->palette);
xfree(clrconv); free(clrconv);
} }
} }

View File

@ -1414,7 +1414,7 @@ struct rdp_mppc_dec* mppc_dec_new(void)
{ {
struct rdp_mppc_dec* ptr; struct rdp_mppc_dec* ptr;
ptr = (struct rdp_mppc_dec*) xmalloc(sizeof(struct rdp_mppc_dec)); ptr = (struct rdp_mppc_dec*) malloc(sizeof(struct rdp_mppc_dec));
if (!ptr) if (!ptr)
{ {
printf("mppc_new(): system out of memory\n"); printf("mppc_new(): system out of memory\n");
@ -1426,7 +1426,7 @@ struct rdp_mppc_dec* mppc_dec_new(void)
if (!ptr->history_buf) if (!ptr->history_buf)
{ {
printf("mppc_new(): system out of memory\n"); printf("mppc_new(): system out of memory\n");
xfree(ptr); free(ptr);
return NULL; return NULL;
} }
@ -1450,14 +1450,14 @@ void mppc_dec_free(struct rdp_mppc_dec* dec)
if (dec->history_buf) if (dec->history_buf)
{ {
xfree(dec->history_buf); free(dec->history_buf);
dec->history_buf = NULL; dec->history_buf = NULL;
dec->history_ptr = NULL; dec->history_ptr = NULL;
} }
if (dec->offset_cache) if (dec->offset_cache)
{ {
xfree(dec->offset_cache); free(dec->offset_cache);
dec->offset_cache = NULL; dec->offset_cache = NULL;
} }
xfree(dec); free(dec);
} }

View File

@ -444,30 +444,30 @@ struct rdp_mppc_enc* mppc_enc_new(int protocol_type)
enc->buf_len = RDP_50_HIST_BUF_LEN; enc->buf_len = RDP_50_HIST_BUF_LEN;
break; break;
default: default:
xfree(enc); free(enc);
return NULL; return NULL;
} }
enc->first_pkt = 1; enc->first_pkt = 1;
enc->historyBuffer = (char*) xzalloc(enc->buf_len); enc->historyBuffer = (char*) xzalloc(enc->buf_len);
if (enc->historyBuffer == NULL) if (enc->historyBuffer == NULL)
{ {
xfree(enc); free(enc);
return NULL; return NULL;
} }
enc->outputBufferPlus = (char*) xzalloc(enc->buf_len + 64); enc->outputBufferPlus = (char*) xzalloc(enc->buf_len + 64);
if (enc->outputBufferPlus == NULL) if (enc->outputBufferPlus == NULL)
{ {
xfree(enc->historyBuffer); free(enc->historyBuffer);
xfree(enc); free(enc);
return NULL; return NULL;
} }
enc->outputBuffer = enc->outputBufferPlus + 64; enc->outputBuffer = enc->outputBufferPlus + 64;
enc->hash_table = (uint16*) xzalloc(enc->buf_len * 2); enc->hash_table = (uint16*) xzalloc(enc->buf_len * 2);
if (enc->hash_table == NULL) if (enc->hash_table == NULL)
{ {
xfree(enc->historyBuffer); free(enc->historyBuffer);
xfree(enc->outputBufferPlus); free(enc->outputBufferPlus);
xfree(enc); free(enc);
return NULL; return NULL;
} }
return enc; return enc;
@ -483,10 +483,10 @@ void mppc_enc_free(struct rdp_mppc_enc* enc)
{ {
if (enc == NULL) if (enc == NULL)
return; return;
xfree(enc->historyBuffer); free(enc->historyBuffer);
xfree(enc->outputBufferPlus); free(enc->outputBufferPlus);
xfree(enc->hash_table); free(enc->hash_table);
xfree(enc); free(enc);
} }
/** /**

View File

@ -199,7 +199,7 @@ static void nsc_context_initialize(NSC_CONTEXT* context, STREAM* s)
} }
else if (length > context->bmpdata_length) else if (length > context->bmpdata_length)
{ {
context->bmpdata = xrealloc(context->bmpdata, length + 16); context->bmpdata = realloc(context->bmpdata, length + 16);
context->bmpdata_length = length; context->bmpdata_length = length;
} }
@ -210,7 +210,7 @@ static void nsc_context_initialize(NSC_CONTEXT* context, STREAM* s)
if (length > context->priv->plane_buf_length) if (length > context->priv->plane_buf_length)
{ {
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
context->priv->plane_buf[i] = (uint8*) xrealloc(context->priv->plane_buf[i], length); context->priv->plane_buf[i] = (uint8*) realloc(context->priv->plane_buf[i], length);
context->priv->plane_buf_length = length; context->priv->plane_buf_length = length;
} }
@ -244,10 +244,10 @@ void nsc_context_free(NSC_CONTEXT* context)
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
if (context->priv->plane_buf[i]) if (context->priv->plane_buf[i])
xfree(context->priv->plane_buf[i]); free(context->priv->plane_buf[i]);
} }
if (context->bmpdata) if (context->bmpdata)
xfree(context->bmpdata); free(context->bmpdata);
nsc_profiler_print(context); nsc_profiler_print(context);
PROFILER_FREE(context->priv->prof_nsc_rle_decompress_data); PROFILER_FREE(context->priv->prof_nsc_rle_decompress_data);
@ -255,8 +255,8 @@ void nsc_context_free(NSC_CONTEXT* context)
PROFILER_FREE(context->priv->prof_nsc_rle_compress_data); PROFILER_FREE(context->priv->prof_nsc_rle_compress_data);
PROFILER_FREE(context->priv->prof_nsc_encode); PROFILER_FREE(context->priv->prof_nsc_encode);
xfree(context->priv); free(context->priv);
xfree(context); free(context);
} }
NSC_CONTEXT* nsc_context_new(void) NSC_CONTEXT* nsc_context_new(void)

View File

@ -48,7 +48,7 @@ static void nsc_context_initialize_encode(NSC_CONTEXT* context)
if (length > context->priv->plane_buf_length) if (length > context->priv->plane_buf_length)
{ {
for (i = 0; i < 5; i++) for (i = 0; i < 5; i++)
context->priv->plane_buf[i] = (uint8*) xrealloc(context->priv->plane_buf[i], length); context->priv->plane_buf[i] = (uint8*) realloc(context->priv->plane_buf[i], length);
context->priv->plane_buf_length = length; context->priv->plane_buf_length = length;
} }

View File

@ -177,15 +177,15 @@ void rfx_context_set_cpu_opt(RFX_CONTEXT* context, uint32 cpu_opt)
void rfx_context_free(RFX_CONTEXT* context) void rfx_context_free(RFX_CONTEXT* context)
{ {
xfree(context->quants); free(context->quants);
rfx_pool_free(context->priv->pool); rfx_pool_free(context->priv->pool);
rfx_profiler_print(context); rfx_profiler_print(context);
rfx_profiler_free(context); rfx_profiler_free(context);
xfree(context->priv); free(context->priv);
xfree(context); free(context);
} }
void rfx_context_set_pixel_format(RFX_CONTEXT* context, RDP_PIXEL_FORMAT pixel_format) void rfx_context_set_pixel_format(RFX_CONTEXT* context, RDP_PIXEL_FORMAT pixel_format)
@ -362,9 +362,9 @@ static void rfx_process_message_region(RFX_CONTEXT* context, RFX_MESSAGE* messag
} }
if (message->rects != NULL) if (message->rects != NULL)
message->rects = (RFX_RECT*) xrealloc(message->rects, message->num_rects * sizeof(RFX_RECT)); message->rects = (RFX_RECT*) realloc(message->rects, message->num_rects * sizeof(RFX_RECT));
else else
message->rects = (RFX_RECT*) xmalloc(message->num_rects * sizeof(RFX_RECT)); message->rects = (RFX_RECT*) malloc(message->num_rects * sizeof(RFX_RECT));
/* rects */ /* rects */
for (i = 0; i < message->num_rects; i++) for (i = 0; i < message->num_rects; i++)
@ -453,9 +453,9 @@ static void rfx_process_message_tileset(RFX_CONTEXT* context, RFX_MESSAGE* messa
stream_read_uint32(s, tilesDataSize); /* tilesDataSize (4 bytes) */ stream_read_uint32(s, tilesDataSize); /* tilesDataSize (4 bytes) */
if (context->quants != NULL) if (context->quants != NULL)
context->quants = (uint32*) xrealloc((void*) context->quants, context->num_quants * 10 * sizeof(uint32)); context->quants = (uint32*) realloc((void*) context->quants, context->num_quants * 10 * sizeof(uint32));
else else
context->quants = (uint32*) xmalloc(context->num_quants * 10 * sizeof(uint32)); context->quants = (uint32*) malloc(context->num_quants * 10 * sizeof(uint32));
quants = context->quants; quants = context->quants;
/* quantVals */ /* quantVals */
@ -617,15 +617,15 @@ void rfx_message_free(RFX_CONTEXT* context, RFX_MESSAGE* message)
{ {
if (message != NULL) if (message != NULL)
{ {
xfree(message->rects); free(message->rects);
if (message->tiles != NULL) if (message->tiles != NULL)
{ {
rfx_pool_put_tiles(context->priv->pool, message->tiles, message->num_tiles); rfx_pool_put_tiles(context->priv->pool, message->tiles, message->num_tiles);
xfree(message->tiles); free(message->tiles);
} }
xfree(message); free(message);
} }
} }

View File

@ -53,14 +53,14 @@ void rfx_pool_free(RFX_POOL* pool)
if (tile != NULL) if (tile != NULL)
{ {
if (tile->data != NULL) if (tile->data != NULL)
xfree(tile->data); free(tile->data);
xfree(tile); free(tile);
} }
} }
xfree(pool->tiles); free(pool->tiles);
xfree(pool); free(pool);
} }
void rfx_pool_put_tile(RFX_POOL* pool, RFX_TILE* tile) void rfx_pool_put_tile(RFX_POOL* pool, RFX_TILE* tile)
@ -68,7 +68,7 @@ void rfx_pool_put_tile(RFX_POOL* pool, RFX_TILE* tile)
if (pool->count >= pool->size) if (pool->count >= pool->size)
{ {
pool->size *= 2; pool->size *= 2;
pool->tiles = (RFX_TILE**) xrealloc((void*) pool->tiles, sizeof(RFX_TILE*) * pool->size); pool->tiles = (RFX_TILE**) realloc((void*) pool->tiles, sizeof(RFX_TILE*) * pool->size);
} }
pool->tiles[(pool->count)++] = tile; pool->tiles[(pool->count)++] = tile;
@ -81,7 +81,7 @@ RFX_TILE* rfx_pool_get_tile(RFX_POOL* pool)
if (pool->count < 1) if (pool->count < 1)
{ {
tile = xnew(RFX_TILE); tile = xnew(RFX_TILE);
tile->data = (uint8*) xmalloc(4096 * 4); /* 64x64 * 4 */ tile->data = (uint8*) malloc(4096 * 4); /* 64x64 * 4 */
} }
else else
{ {
@ -106,7 +106,7 @@ RFX_TILE** rfx_pool_get_tiles(RFX_POOL* pool, int count)
int i; int i;
RFX_TILE** tiles; RFX_TILE** tiles;
tiles = (RFX_TILE**) xmalloc(sizeof(RFX_TILE*) * count); tiles = (RFX_TILE**) malloc(sizeof(RFX_TILE*) * count);
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {

View File

@ -234,7 +234,7 @@ int rfx_rlgr_decode(RLGR_MODE mode, const uint8* data, int data_size, sint16* bu
} }
} }
xfree(bs); free(bs);
return (dst - buffer); return (dst - buffer);
} }
@ -431,7 +431,7 @@ int rfx_rlgr_encode(RLGR_MODE mode, const sint16* data, int data_size, uint8* bu
} }
processed_size = rfx_bitstream_get_processed_bytes(bs); processed_size = rfx_bitstream_get_processed_bytes(bs);
xfree(bs); free(bs);
return processed_size; return processed_size;
} }

View File

@ -218,7 +218,7 @@ rdpX509CertChain* certificate_new_x509_certificate_chain(uint32 count)
{ {
rdpX509CertChain* x509_cert_chain; rdpX509CertChain* x509_cert_chain;
x509_cert_chain = (rdpX509CertChain*) xmalloc(sizeof(rdpX509CertChain)); x509_cert_chain = (rdpX509CertChain*) malloc(sizeof(rdpX509CertChain));
x509_cert_chain->count = count; x509_cert_chain->count = count;
x509_cert_chain->array = (rdpCertBlob*) xzalloc(sizeof(rdpCertBlob) * count); x509_cert_chain->array = (rdpCertBlob*) xzalloc(sizeof(rdpCertBlob) * count);
@ -240,11 +240,11 @@ void certificate_free_x509_certificate_chain(rdpX509CertChain* x509_cert_chain)
for (i = 0; i < (int) x509_cert_chain->count; i++) for (i = 0; i < (int) x509_cert_chain->count; i++)
{ {
if (x509_cert_chain->array[i].data != NULL) if (x509_cert_chain->array[i].data != NULL)
xfree(x509_cert_chain->array[i].data); free(x509_cert_chain->array[i].data);
} }
xfree(x509_cert_chain->array); free(x509_cert_chain->array);
xfree(x509_cert_chain); free(x509_cert_chain);
} }
} }
@ -428,7 +428,7 @@ boolean certificate_read_server_x509_certificate_chain(rdpCertificate* certifica
DEBUG_CERTIFICATE("\nX.509 Certificate #%d, length:%d", i + 1, certLength); DEBUG_CERTIFICATE("\nX.509 Certificate #%d, length:%d", i + 1, certLength);
certificate->x509_cert_chain->array[i].data = (uint8*) xmalloc(certLength); certificate->x509_cert_chain->array[i].data = (uint8*) malloc(certLength);
stream_read(s, certificate->x509_cert_chain->array[i].data, certLength); stream_read(s, certificate->x509_cert_chain->array[i].data, certLength);
certificate->x509_cert_chain->array[i].length = certLength; certificate->x509_cert_chain->array[i].length = certLength;
@ -489,7 +489,7 @@ boolean certificate_read_server_certificate(rdpCertificate* certificate, uint8*
break; break;
} }
xfree(s); free(s);
return true; return true;
} }
@ -509,7 +509,7 @@ rdpKey* key_new(const char* keyfile)
if (fp == NULL) if (fp == NULL)
{ {
printf("unable to load RSA key from %s: %s.", keyfile, strerror(errno)); printf("unable to load RSA key from %s: %s.", keyfile, strerror(errno));
xfree(key) ; free(key) ;
return NULL; return NULL;
} }
@ -519,7 +519,7 @@ rdpKey* key_new(const char* keyfile)
{ {
ERR_print_errors_fp(stdout); ERR_print_errors_fp(stdout);
fclose(fp); fclose(fp);
xfree(key) ; free(key) ;
return NULL; return NULL;
} }
@ -530,7 +530,7 @@ rdpKey* key_new(const char* keyfile)
case 0: case 0:
RSA_free(rsa); RSA_free(rsa);
printf("invalid RSA key in %s", keyfile); printf("invalid RSA key in %s", keyfile);
xfree(key) ; free(key) ;
return NULL; return NULL;
case 1: case 1:
@ -540,7 +540,7 @@ rdpKey* key_new(const char* keyfile)
default: default:
ERR_print_errors_fp(stdout); ERR_print_errors_fp(stdout);
RSA_free(rsa); RSA_free(rsa);
xfree(key) ; free(key) ;
return NULL; return NULL;
} }
@ -548,7 +548,7 @@ rdpKey* key_new(const char* keyfile)
{ {
RSA_free(rsa); RSA_free(rsa);
printf("RSA public exponent too large in %s", keyfile); printf("RSA public exponent too large in %s", keyfile);
xfree(key) ; free(key) ;
return NULL; return NULL;
} }
@ -577,7 +577,7 @@ void key_free(rdpKey* key)
{ {
free(key->Modulus); free(key->Modulus);
free(key->PrivateExponent); free(key->PrivateExponent);
xfree(key); free(key);
} }
} }
@ -615,6 +615,6 @@ void certificate_free(rdpCertificate* certificate)
if (certificate->cert_info.Modulus != NULL) if (certificate->cert_info.Modulus != NULL)
free(certificate->cert_info.Modulus); free(certificate->cert_info.Modulus);
xfree(certificate); free(certificate);
} }
} }

View File

@ -146,7 +146,7 @@ boolean rdp_client_redirect(rdpRdp* rdp)
free(settings->server_random); free(settings->server_random);
free(settings->server_certificate); free(settings->server_certificate);
xfree(settings->ip_address); free(settings->ip_address);
rdp->transport = transport_new(settings); rdp->transport = transport_new(settings);
rdp->license = license_new(rdp); rdp->license = license_new(rdp);
@ -164,30 +164,30 @@ boolean rdp_client_redirect(rdpRdp* rdp)
{ {
if (redirection->flags & LB_TARGET_NET_ADDRESS) if (redirection->flags & LB_TARGET_NET_ADDRESS)
{ {
xfree(settings->hostname); free(settings->hostname);
settings->hostname = xstrdup(redirection->targetNetAddress.ascii); settings->hostname = xstrdup(redirection->targetNetAddress.ascii);
} }
else if (redirection->flags & LB_TARGET_FQDN) else if (redirection->flags & LB_TARGET_FQDN)
{ {
xfree(settings->hostname); free(settings->hostname);
settings->hostname = xstrdup(redirection->targetFQDN.ascii); settings->hostname = xstrdup(redirection->targetFQDN.ascii);
} }
else if (redirection->flags & LB_TARGET_NETBIOS_NAME) else if (redirection->flags & LB_TARGET_NETBIOS_NAME)
{ {
xfree(settings->hostname); free(settings->hostname);
settings->hostname = xstrdup(redirection->targetNetBiosName.ascii); settings->hostname = xstrdup(redirection->targetNetBiosName.ascii);
} }
} }
if (redirection->flags & LB_USERNAME) if (redirection->flags & LB_USERNAME)
{ {
xfree(settings->username); free(settings->username);
settings->username = xstrdup(redirection->username.ascii); settings->username = xstrdup(redirection->username.ascii);
} }
if (redirection->flags & LB_DOMAIN) if (redirection->flags & LB_DOMAIN)
{ {
xfree(settings->domain); free(settings->domain);
settings->domain = xstrdup(redirection->domain.ascii); settings->domain = xstrdup(redirection->domain.ascii);
} }

View File

@ -224,6 +224,6 @@ void extension_free(rdpExtension* extension)
if (extension != NULL) if (extension != NULL)
{ {
extension_uninit_plugins(extension); extension_uninit_plugins(extension);
xfree(extension); free(extension);
} }
} }

View File

@ -333,7 +333,7 @@ static boolean fastpath_recv_update_data(rdpFastPath* fastpath, STREAM* s)
stream_set_pos(s, next_pos); stream_set_pos(s, next_pos);
if (comp_stream != s) if (comp_stream != s)
xfree(comp_stream); free(comp_stream);
return true; return true;
} }
@ -774,5 +774,5 @@ rdpFastPath* fastpath_new(rdpRdp* rdp)
void fastpath_free(rdpFastPath* fastpath) void fastpath_free(rdpFastPath* fastpath)
{ {
stream_free(fastpath->updateData); stream_free(fastpath->updateData);
xfree(fastpath); free(fastpath);
} }

View File

@ -132,7 +132,7 @@ boolean freerdp_connect(freerdp* instance)
{ {
pcap_get_next_record_header(update->pcap_rfx, &record); pcap_get_next_record_header(update->pcap_rfx, &record);
s->data = (uint8*) xrealloc(s->data, record.length); s->data = (uint8*) realloc(s->data, record.length);
record.data = s->data; record.data = s->data;
s->size = record.length; s->size = record.length;
@ -144,7 +144,7 @@ boolean freerdp_connect(freerdp* instance)
update->EndPaint(update->context); update->EndPaint(update->context);
} }
xfree(s->data); free(s->data);
return true; return true;
} }
} }
@ -269,7 +269,7 @@ void freerdp_context_free(freerdp* instance)
rdp_free(instance->context->rdp); rdp_free(instance->context->rdp);
graphics_free(instance->context->graphics); graphics_free(instance->context->graphics);
xfree(instance->context); free(instance->context);
instance->context = NULL; instance->context = NULL;
} }
@ -304,6 +304,6 @@ void freerdp_free(freerdp* instance)
{ {
if (instance) if (instance)
{ {
xfree(instance); free(instance);
} }
} }

View File

@ -495,7 +495,7 @@ boolean gcc_read_client_core_data(STREAM* s, rdpSettings* settings, uint16 block
stream_seek(s, 32); stream_seek(s, 32);
snprintf(settings->client_hostname, 31, "%s", str); snprintf(settings->client_hostname, 31, "%s", str);
settings->client_hostname[31] = 0; settings->client_hostname[31] = 0;
xfree(str); free(str);
stream_read_uint32(s, settings->kbd_type); /* keyboardType */ stream_read_uint32(s, settings->kbd_type); /* keyboardType */
stream_read_uint32(s, settings->kbd_subtype); /* keyboardSubType */ stream_read_uint32(s, settings->kbd_subtype); /* keyboardSubType */
@ -550,7 +550,7 @@ boolean gcc_read_client_core_data(STREAM* s, rdpSettings* settings, uint16 block
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &str, 64 / 2); freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &str, 64 / 2);
stream_seek(s, 64); stream_seek(s, 64);
snprintf(settings->client_product_id, 32, "%s", str); snprintf(settings->client_product_id, 32, "%s", str);
xfree(str); free(str);
blockLength -= 64; blockLength -= 64;
if (blockLength < 1) if (blockLength < 1)
@ -666,7 +666,7 @@ void gcc_write_client_core_data(STREAM* s, rdpSettings* settings)
stream_write(s, clientName, ((clientNameLength + 1) * 2)); stream_write(s, clientName, ((clientNameLength + 1) * 2));
stream_write_zero(s, 32 - ((clientNameLength + 1) * 2)); stream_write_zero(s, 32 - ((clientNameLength + 1) * 2));
xfree(clientName); free(clientName);
stream_write_uint32(s, settings->kbd_type); /* keyboardType */ stream_write_uint32(s, settings->kbd_type); /* keyboardType */
stream_write_uint32(s, settings->kbd_subtype); /* keyboardSubType */ stream_write_uint32(s, settings->kbd_subtype); /* keyboardSubType */
@ -714,7 +714,7 @@ void gcc_write_client_core_data(STREAM* s, rdpSettings* settings)
} }
stream_write(s, clientDigProductId, clientDigProductIdLength + 2); stream_write(s, clientDigProductId, clientDigProductIdLength + 2);
stream_write_zero(s, 64 - clientDigProductIdLength - 2); stream_write_zero(s, 64 - clientDigProductIdLength - 2);
xfree(clientDigProductId); free(clientDigProductId);
stream_write_uint8(s, connectionType); /* connectionType */ stream_write_uint8(s, connectionType); /* connectionType */
stream_write_uint8(s, 0); /* pad1octet */ stream_write_uint8(s, 0); /* pad1octet */

View File

@ -33,7 +33,7 @@ rdpBitmap* Bitmap_Alloc(rdpContext* context)
rdpGraphics* graphics; rdpGraphics* graphics;
graphics = context->graphics; graphics = context->graphics;
bitmap = (rdpBitmap*) xmalloc(graphics->Bitmap_Prototype->size); bitmap = (rdpBitmap*) malloc(graphics->Bitmap_Prototype->size);
if (bitmap != NULL) if (bitmap != NULL)
{ {
@ -56,9 +56,9 @@ void Bitmap_Free(rdpContext* context, rdpBitmap* bitmap)
bitmap->Free(context, bitmap); bitmap->Free(context, bitmap);
if (bitmap->data != NULL) if (bitmap->data != NULL)
xfree(bitmap->data); free(bitmap->data);
xfree(bitmap); free(bitmap);
} }
} }
@ -95,7 +95,7 @@ rdpPointer* Pointer_Alloc(rdpContext* context)
rdpGraphics* graphics; rdpGraphics* graphics;
graphics = context->graphics; graphics = context->graphics;
pointer = (rdpPointer*) xmalloc(graphics->Pointer_Prototype->size); pointer = (rdpPointer*) malloc(graphics->Pointer_Prototype->size);
if (pointer != NULL) if (pointer != NULL)
{ {
@ -117,12 +117,12 @@ void Pointer_Free(rdpContext* context, rdpPointer* pointer)
pointer->Free(context, pointer); pointer->Free(context, pointer);
if (pointer->xorMaskData) if (pointer->xorMaskData)
xfree(pointer->xorMaskData); free(pointer->xorMaskData);
if (pointer->andMaskData) if (pointer->andMaskData)
xfree(pointer->andMaskData); free(pointer->andMaskData);
xfree(pointer); free(pointer);
} }
} }
@ -155,7 +155,7 @@ rdpGlyph* Glyph_Alloc(rdpContext* context)
rdpGraphics* graphics; rdpGraphics* graphics;
graphics = context->graphics; graphics = context->graphics;
glyph = (rdpGlyph*) xmalloc(graphics->Glyph_Prototype->size); glyph = (rdpGlyph*) malloc(graphics->Glyph_Prototype->size);
if (glyph != NULL) if (glyph != NULL)
{ {
@ -230,9 +230,9 @@ void graphics_free(rdpGraphics* graphics)
{ {
if (graphics != NULL) if (graphics != NULL)
{ {
xfree(graphics->Bitmap_Prototype); free(graphics->Bitmap_Prototype);
xfree(graphics->Pointer_Prototype); free(graphics->Pointer_Prototype);
xfree(graphics->Glyph_Prototype); free(graphics->Glyph_Prototype);
xfree(graphics); free(graphics);
} }
} }

View File

@ -42,7 +42,7 @@ HttpContext* http_context_new()
void http_context_set_method(HttpContext* http_context, char* method) void http_context_set_method(HttpContext* http_context, char* method)
{ {
if (http_context->Method) if (http_context->Method)
xfree(http_context->Method); free(http_context->Method);
http_context->Method = xstrdup(method); http_context->Method = xstrdup(method);
} }
@ -50,7 +50,7 @@ void http_context_set_method(HttpContext* http_context, char* method)
void http_context_set_uri(HttpContext* http_context, char* uri) void http_context_set_uri(HttpContext* http_context, char* uri)
{ {
if (http_context->URI) if (http_context->URI)
xfree(http_context->URI); free(http_context->URI);
http_context->URI = xstrdup(uri); http_context->URI = xstrdup(uri);
} }
@ -58,7 +58,7 @@ void http_context_set_uri(HttpContext* http_context, char* uri)
void http_context_set_user_agent(HttpContext* http_context, char* user_agent) void http_context_set_user_agent(HttpContext* http_context, char* user_agent)
{ {
if (http_context->UserAgent) if (http_context->UserAgent)
xfree(http_context->UserAgent); free(http_context->UserAgent);
http_context->UserAgent = xstrdup(user_agent); http_context->UserAgent = xstrdup(user_agent);
} }
@ -66,7 +66,7 @@ void http_context_set_user_agent(HttpContext* http_context, char* user_agent)
void http_context_set_host(HttpContext* http_context, char* host) void http_context_set_host(HttpContext* http_context, char* host)
{ {
if (http_context->Host) if (http_context->Host)
xfree(http_context->Host); free(http_context->Host);
http_context->Host = xstrdup(host); http_context->Host = xstrdup(host);
} }
@ -74,7 +74,7 @@ void http_context_set_host(HttpContext* http_context, char* host)
void http_context_set_accept(HttpContext* http_context, char* accept) void http_context_set_accept(HttpContext* http_context, char* accept)
{ {
if (http_context->Accept) if (http_context->Accept)
xfree(http_context->Accept); free(http_context->Accept);
http_context->Accept = xstrdup(accept); http_context->Accept = xstrdup(accept);
} }
@ -82,7 +82,7 @@ void http_context_set_accept(HttpContext* http_context, char* accept)
void http_context_set_cache_control(HttpContext* http_context, char* cache_control) void http_context_set_cache_control(HttpContext* http_context, char* cache_control)
{ {
if (http_context->CacheControl) if (http_context->CacheControl)
xfree(http_context->CacheControl); free(http_context->CacheControl);
http_context->CacheControl = xstrdup(cache_control); http_context->CacheControl = xstrdup(cache_control);
} }
@ -90,7 +90,7 @@ void http_context_set_cache_control(HttpContext* http_context, char* cache_contr
void http_context_set_connection(HttpContext* http_context, char* connection) void http_context_set_connection(HttpContext* http_context, char* connection)
{ {
if (http_context->Connection) if (http_context->Connection)
xfree(http_context->Connection); free(http_context->Connection);
http_context->Connection = xstrdup(connection); http_context->Connection = xstrdup(connection);
} }
@ -98,7 +98,7 @@ void http_context_set_connection(HttpContext* http_context, char* connection)
void http_context_set_pragma(HttpContext* http_context, char* pragma) void http_context_set_pragma(HttpContext* http_context, char* pragma)
{ {
if (http_context->Pragma) if (http_context->Pragma)
xfree(http_context->Pragma); free(http_context->Pragma);
http_context->Pragma = xstrdup(pragma); http_context->Pragma = xstrdup(pragma);
} }
@ -107,20 +107,20 @@ void http_context_free(HttpContext* http_context)
{ {
if (http_context != NULL) if (http_context != NULL)
{ {
xfree(http_context->UserAgent); free(http_context->UserAgent);
xfree(http_context->Host); free(http_context->Host);
xfree(http_context->Accept); free(http_context->Accept);
xfree(http_context->CacheControl); free(http_context->CacheControl);
xfree(http_context->Connection); free(http_context->Connection);
xfree(http_context->Pragma); free(http_context->Pragma);
xfree(http_context); free(http_context);
} }
} }
void http_request_set_method(HttpRequest* http_request, char* method) void http_request_set_method(HttpRequest* http_request, char* method)
{ {
if (http_request->Method) if (http_request->Method)
xfree(http_request->Method); free(http_request->Method);
http_request->Method = xstrdup(method); http_request->Method = xstrdup(method);
} }
@ -128,7 +128,7 @@ void http_request_set_method(HttpRequest* http_request, char* method)
void http_request_set_uri(HttpRequest* http_request, char* uri) void http_request_set_uri(HttpRequest* http_request, char* uri)
{ {
if (http_request->URI) if (http_request->URI)
xfree(http_request->URI); free(http_request->URI);
http_request->URI = xstrdup(uri); http_request->URI = xstrdup(uri);
} }
@ -136,7 +136,7 @@ void http_request_set_uri(HttpRequest* http_request, char* uri)
void http_request_set_auth_scheme(HttpRequest* http_request, char* auth_scheme) void http_request_set_auth_scheme(HttpRequest* http_request, char* auth_scheme)
{ {
if (http_request->AuthScheme) if (http_request->AuthScheme)
xfree(http_request->AuthScheme); free(http_request->AuthScheme);
http_request->AuthScheme = xstrdup(auth_scheme); http_request->AuthScheme = xstrdup(auth_scheme);
} }
@ -144,7 +144,7 @@ void http_request_set_auth_scheme(HttpRequest* http_request, char* auth_scheme)
void http_request_set_auth_param(HttpRequest* http_request, char* auth_param) void http_request_set_auth_param(HttpRequest* http_request, char* auth_param)
{ {
if (http_request->AuthParam) if (http_request->AuthParam)
xfree(http_request->AuthParam); free(http_request->AuthParam);
http_request->AuthParam = xstrdup(auth_param); http_request->AuthParam = xstrdup(auth_param);
} }
@ -261,11 +261,11 @@ STREAM* http_request_write(HttpContext* http_context, HttpRequest* http_request)
{ {
stream_write(s, http_request->lines[i], strlen(http_request->lines[i])); stream_write(s, http_request->lines[i], strlen(http_request->lines[i]));
stream_write(s, "\n", 1); stream_write(s, "\n", 1);
xfree(http_request->lines[i]); free(http_request->lines[i]);
} }
stream_write(s, "\n", 1); stream_write(s, "\n", 1);
xfree(http_request->lines); free(http_request->lines);
stream_write(s, "\0", 1); /* append null terminator */ stream_write(s, "\0", 1); /* append null terminator */
stream_rewind(s, 1); /* don't include null terminator in length */ stream_rewind(s, 1); /* don't include null terminator in length */
@ -290,9 +290,9 @@ void http_request_free(HttpRequest* http_request)
{ {
if (http_request != NULL) if (http_request != NULL)
{ {
xfree(http_request->Method); free(http_request->Method);
xfree(http_request->URI); free(http_request->URI);
xfree(http_request); free(http_request);
} }
} }
@ -420,7 +420,7 @@ HttpResponse* http_response_recv(rdpTls* tls)
nbytes = 0; nbytes = 0;
length = 10000; length = 10000;
buffer = xmalloc(length); buffer = malloc(length);
http_response = http_response_new(); http_response = http_response_new();
p = buffer; p = buffer;
@ -466,7 +466,7 @@ HttpResponse* http_response_recv(rdpTls* tls)
} }
http_response->count = count; http_response->count = count;
http_response->lines = (char**) xmalloc(sizeof(char*) * http_response->count); http_response->lines = (char**) malloc(sizeof(char*) * http_response->count);
count = 0; count = 0;
line = strtok((char*) buffer, "\r\n"); line = strtok((char*) buffer, "\r\n");
@ -491,12 +491,12 @@ HttpResponse* http_response_recv(rdpTls* tls)
if ((length - nbytes) <= 0) if ((length - nbytes) <= 0)
{ {
length *= 2; length *= 2;
buffer = xrealloc(buffer, length); buffer = realloc(buffer, length);
p = (uint8*) &buffer[nbytes]; p = (uint8*) &buffer[nbytes];
} }
} }
xfree(buffer); free(buffer);
return http_response; return http_response;
} }
@ -520,19 +520,19 @@ void http_response_free(HttpResponse* http_response)
if (http_response != NULL) if (http_response != NULL)
{ {
for (i = 0; i < http_response->count; i++) for (i = 0; i < http_response->count; i++)
xfree(http_response->lines[i]); free(http_response->lines[i]);
xfree(http_response->lines); free(http_response->lines);
xfree(http_response->ReasonPhrase); free(http_response->ReasonPhrase);
xfree(http_response->AuthParam); free(http_response->AuthParam);
xfree(http_response->AuthScheme); free(http_response->AuthScheme);
xfree(http_response->Authorization); free(http_response->Authorization);
if (http_response->ContentLength > 0) if (http_response->ContentLength > 0)
xfree(http_response->Content); free(http_response->Content);
xfree(http_response); free(http_response);
} }
} }

View File

@ -132,7 +132,7 @@ boolean rdp_read_extended_info_packet(STREAM* s, rdpSettings* settings)
return false; return false;
if (settings->client_dir) if (settings->client_dir)
xfree(settings->client_dir); free(settings->client_dir);
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &settings->client_dir, cbClientDir / 2); freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &settings->client_dir, cbClientDir / 2);
stream_seek(s, cbClientDir); stream_seek(s, cbClientDir);
@ -205,8 +205,8 @@ void rdp_write_extended_info_packet(STREAM* s, rdpSettings* settings)
/* reserved1 (2 bytes) */ /* reserved1 (2 bytes) */
/* reserved2 (2 bytes) */ /* reserved2 (2 bytes) */
xfree(clientAddress); free(clientAddress);
xfree(clientDir); free(clientDir);
} }
/** /**
@ -399,13 +399,13 @@ void rdp_write_info_packet(STREAM* s, rdpSettings* settings)
stream_write(s, workingDir, cbWorkingDir); stream_write(s, workingDir, cbWorkingDir);
stream_write_uint16(s, 0); stream_write_uint16(s, 0);
xfree(domain); free(domain);
xfree(userName); free(userName);
xfree(alternateShell); free(alternateShell);
xfree(workingDir); free(workingDir);
if (!usedPasswordCookie) if (!usedPasswordCookie)
xfree(password); free(password);
if (settings->rdp_version >= 5) if (settings->rdp_version >= 5)
rdp_write_extended_info_packet(s, settings); /* extraInfo */ rdp_write_extended_info_packet(s, settings); /* extraInfo */

View File

@ -437,6 +437,6 @@ void input_free(rdpInput* input)
{ {
if (input != NULL) if (input != NULL)
{ {
xfree(input); free(input);
} }
} }

View File

@ -331,7 +331,7 @@ void license_encrypt_premaster_secret(rdpLicense* license)
freerdp_hexdump(exponent, 4); freerdp_hexdump(exponent, 4);
#endif #endif
encrypted_premaster_secret = (uint8*) xmalloc(MODULUS_MAX_SIZE); encrypted_premaster_secret = (uint8*) malloc(MODULUS_MAX_SIZE);
memset(encrypted_premaster_secret, 0, MODULUS_MAX_SIZE); memset(encrypted_premaster_secret, 0, MODULUS_MAX_SIZE);
crypto_rsa_public_encrypt(license->premaster_secret, PREMASTER_SECRET_LENGTH, crypto_rsa_public_encrypt(license->premaster_secret, PREMASTER_SECRET_LENGTH,
@ -341,7 +341,7 @@ void license_encrypt_premaster_secret(rdpLicense* license)
license->encrypted_premaster_secret->length = PREMASTER_SECRET_LENGTH; license->encrypted_premaster_secret->length = PREMASTER_SECRET_LENGTH;
license->encrypted_premaster_secret->data = encrypted_premaster_secret; license->encrypted_premaster_secret->data = encrypted_premaster_secret;
#else #else
encrypted_premaster_secret = (uint8*) xmalloc(MODULUS_MAX_SIZE); encrypted_premaster_secret = (uint8*) malloc(MODULUS_MAX_SIZE);
memset(encrypted_premaster_secret, 0, MODULUS_MAX_SIZE); memset(encrypted_premaster_secret, 0, MODULUS_MAX_SIZE);
license->encrypted_premaster_secret->type = BB_RANDOM_BLOB; license->encrypted_premaster_secret->type = BB_RANDOM_BLOB;
@ -355,7 +355,7 @@ void license_decrypt_platform_challenge(rdpLicense* license)
CryptoRc4 rc4; CryptoRc4 rc4;
license->platform_challenge->data = license->platform_challenge->data =
(uint8*) xmalloc(license->encrypted_platform_challenge->length); (uint8*) malloc(license->encrypted_platform_challenge->length);
license->platform_challenge->length = license->platform_challenge->length =
license->encrypted_platform_challenge->length; license->encrypted_platform_challenge->length;
@ -390,12 +390,12 @@ void license_read_product_info(STREAM* s, PRODUCT_INFO* productInfo)
stream_read_uint32(s, productInfo->cbCompanyName); /* cbCompanyName (4 bytes) */ stream_read_uint32(s, productInfo->cbCompanyName); /* cbCompanyName (4 bytes) */
productInfo->pbCompanyName = (uint8*) xmalloc(productInfo->cbCompanyName); productInfo->pbCompanyName = (uint8*) malloc(productInfo->cbCompanyName);
stream_read(s, productInfo->pbCompanyName, productInfo->cbCompanyName); stream_read(s, productInfo->pbCompanyName, productInfo->cbCompanyName);
stream_read_uint32(s, productInfo->cbProductId); /* cbProductId (4 bytes) */ stream_read_uint32(s, productInfo->cbProductId); /* cbProductId (4 bytes) */
productInfo->pbProductId = (uint8*) xmalloc(productInfo->cbProductId); productInfo->pbProductId = (uint8*) malloc(productInfo->cbProductId);
stream_read(s, productInfo->pbProductId, productInfo->cbProductId); stream_read(s, productInfo->pbProductId, productInfo->cbProductId);
} }
@ -409,7 +409,7 @@ PRODUCT_INFO* license_new_product_info()
{ {
PRODUCT_INFO* productInfo; PRODUCT_INFO* productInfo;
productInfo = (PRODUCT_INFO*) xmalloc(sizeof(PRODUCT_INFO)); productInfo = (PRODUCT_INFO*) malloc(sizeof(PRODUCT_INFO));
productInfo->dwVersion = 0; productInfo->dwVersion = 0;
productInfo->cbCompanyName = 0; productInfo->cbCompanyName = 0;
@ -429,12 +429,12 @@ PRODUCT_INFO* license_new_product_info()
void license_free_product_info(PRODUCT_INFO* productInfo) void license_free_product_info(PRODUCT_INFO* productInfo)
{ {
if (productInfo->pbCompanyName != NULL) if (productInfo->pbCompanyName != NULL)
xfree(productInfo->pbCompanyName); free(productInfo->pbCompanyName);
if (productInfo->pbProductId != NULL) if (productInfo->pbProductId != NULL)
xfree(productInfo->pbProductId); free(productInfo->pbProductId);
xfree(productInfo); free(productInfo);
} }
/** /**
@ -464,7 +464,7 @@ void license_read_binary_blob(STREAM* s, LICENSE_BLOB* blob)
} }
blob->type = wBlobType; blob->type = wBlobType;
blob->data = (uint8*) xmalloc(blob->length); blob->data = (uint8*) malloc(blob->length);
stream_read(s, blob->data, blob->length); /* blobData */ stream_read(s, blob->data, blob->length); /* blobData */
} }
@ -509,7 +509,7 @@ LICENSE_BLOB* license_new_binary_blob(uint16 type)
{ {
LICENSE_BLOB* blob; LICENSE_BLOB* blob;
blob = (LICENSE_BLOB*) xmalloc(sizeof(LICENSE_BLOB)); blob = (LICENSE_BLOB*) malloc(sizeof(LICENSE_BLOB));
blob->type = type; blob->type = type;
blob->length = 0; blob->length = 0;
blob->data = NULL; blob->data = NULL;
@ -526,9 +526,9 @@ LICENSE_BLOB* license_new_binary_blob(uint16 type)
void license_free_binary_blob(LICENSE_BLOB* blob) void license_free_binary_blob(LICENSE_BLOB* blob)
{ {
if (blob->data != NULL) if (blob->data != NULL)
xfree(blob->data); free(blob->data);
xfree(blob); free(blob);
} }
/** /**
@ -546,7 +546,7 @@ void license_read_scope_list(STREAM* s, SCOPE_LIST* scopeList)
stream_read_uint32(s, scopeCount); /* ScopeCount (4 bytes) */ stream_read_uint32(s, scopeCount); /* ScopeCount (4 bytes) */
scopeList->count = scopeCount; scopeList->count = scopeCount;
scopeList->array = (LICENSE_BLOB*) xmalloc(sizeof(LICENSE_BLOB) * scopeCount); scopeList->array = (LICENSE_BLOB*) malloc(sizeof(LICENSE_BLOB) * scopeCount);
/* ScopeArray */ /* ScopeArray */
for (i = 0; i < scopeCount; i++) for (i = 0; i < scopeCount; i++)
@ -566,7 +566,7 @@ SCOPE_LIST* license_new_scope_list()
{ {
SCOPE_LIST* scopeList; SCOPE_LIST* scopeList;
scopeList = (SCOPE_LIST*) xmalloc(sizeof(SCOPE_LIST)); scopeList = (SCOPE_LIST*) malloc(sizeof(SCOPE_LIST));
scopeList->count = 0; scopeList->count = 0;
scopeList->array = NULL; scopeList->array = NULL;
@ -585,18 +585,18 @@ void license_free_scope_list(SCOPE_LIST* scopeList)
/* /*
* We must NOT call license_free_binary_blob() on each scopelist->array[i] element, * We must NOT call license_free_binary_blob() on each scopelist->array[i] element,
* because scopelist->array was allocated at once, by a single call to xmalloc. The elements * because scopelist->array was allocated at once, by a single call to malloc. The elements
* it contains cannot be deallocated separately then. * it contains cannot be deallocated separately then.
* To make things clean, we must deallocate each scopelist->array[].data, * To make things clean, we must deallocate each scopelist->array[].data,
* and finish by deallocating scopelist->array with a single call to xfree(). * and finish by deallocating scopelist->array with a single call to free().
*/ */
for (i = 0; i < scopeList->count; i++) for (i = 0; i < scopeList->count; i++)
{ {
xfree(scopeList->array[i].data); free(scopeList->array[i].data);
} }
xfree(scopeList->array) ; free(scopeList->array) ;
xfree(scopeList); free(scopeList);
} }
/** /**
@ -836,13 +836,13 @@ void license_send_platform_challenge_response_packet(rdpLicense* license)
license->encrypted_platform_challenge->type = BB_DATA_BLOB; license->encrypted_platform_challenge->type = BB_DATA_BLOB;
length = license->platform_challenge->length + HWID_LENGTH; length = license->platform_challenge->length + HWID_LENGTH;
buffer = (uint8*) xmalloc(length); buffer = (uint8*) malloc(length);
memcpy(buffer, license->platform_challenge->data, license->platform_challenge->length); memcpy(buffer, license->platform_challenge->data, license->platform_challenge->length);
memcpy(&buffer[license->platform_challenge->length], license->hwid, HWID_LENGTH); memcpy(&buffer[license->platform_challenge->length], license->hwid, HWID_LENGTH);
security_mac_data(license->mac_salt_key, buffer, length, mac_data); security_mac_data(license->mac_salt_key, buffer, length, mac_data);
xfree(buffer); free(buffer);
buffer = (uint8*) xmalloc(HWID_LENGTH); buffer = (uint8*) malloc(HWID_LENGTH);
rc4 = crypto_rc4_init(license->licensing_encryption_key, LICENSING_ENCRYPTION_KEY_LENGTH); rc4 = crypto_rc4_init(license->licensing_encryption_key, LICENSING_ENCRYPTION_KEY_LENGTH);
crypto_rc4(rc4, HWID_LENGTH, license->hwid, buffer); crypto_rc4(rc4, HWID_LENGTH, license->hwid, buffer);
crypto_rc4_free(rc4); crypto_rc4_free(rc4);
@ -945,7 +945,7 @@ void license_free(rdpLicense* license)
license_free_binary_blob(license->encrypted_premaster_secret); license_free_binary_blob(license->encrypted_premaster_secret);
license_free_binary_blob(license->encrypted_hwid); license_free_binary_blob(license->encrypted_hwid);
license_free_scope_list(license->scope_list); license_free_scope_list(license->scope_list);
xfree(license); free(license);
} }
} }

View File

@ -332,8 +332,8 @@ void freerdp_listener_free(freerdp_listener* instance)
rdpListener* listener; rdpListener* listener;
listener = (rdpListener*) instance->listener; listener = (rdpListener*) instance->listener;
xfree(listener); free(listener);
xfree(instance); free(instance);
} }

View File

@ -836,6 +836,6 @@ void mcs_free(rdpMcs* mcs)
{ {
if (mcs != NULL) if (mcs != NULL)
{ {
xfree(mcs); free(mcs);
} }
} }

View File

@ -266,7 +266,7 @@ boolean nego_send_preconnection_pdu(rdpNego* nego)
if (wszPCB) if (wszPCB)
{ {
stream_write(s, wszPCB, cchPCB * 2); /* wszPCB */ stream_write(s, wszPCB, cchPCB * 2); /* wszPCB */
xfree(wszPCB); free(wszPCB);
} }
if (transport_write(nego->transport, s) < 0) if (transport_write(nego->transport, s) < 0)
@ -831,7 +831,7 @@ rdpNego* nego_new(struct rdp_transport * transport)
void nego_free(rdpNego* nego) void nego_free(rdpNego* nego)
{ {
xfree(nego); free(nego);
} }
/** /**

View File

@ -779,9 +779,9 @@ void update_read_polyline_order(STREAM* s, ORDER_INFO* orderInfo, POLYLINE_ORDER
stream_read_uint8(s, polyline->cbData); stream_read_uint8(s, polyline->cbData);
if (polyline->points == NULL) if (polyline->points == NULL)
polyline->points = (DELTA_POINT*) xmalloc(sizeof(DELTA_POINT) * polyline->numPoints); polyline->points = (DELTA_POINT*) malloc(sizeof(DELTA_POINT) * polyline->numPoints);
else else
polyline->points = (DELTA_POINT*) xrealloc(polyline->points, sizeof(DELTA_POINT) * polyline->numPoints); polyline->points = (DELTA_POINT*) realloc(polyline->points, sizeof(DELTA_POINT) * polyline->numPoints);
update_read_delta_points(s, polyline->points, polyline->numPoints, polyline->xStart, polyline->yStart); update_read_delta_points(s, polyline->points, polyline->numPoints, polyline->xStart, polyline->yStart);
} }
@ -1056,7 +1056,7 @@ void update_read_fast_glyph_order(STREAM* s, ORDER_INFO* orderInfo, FAST_GLYPH_O
if ((fast_glyph->cbData > 1) && (fast_glyph->glyph_data == NULL)) if ((fast_glyph->cbData > 1) && (fast_glyph->glyph_data == NULL))
{ {
/* parse optional glyph data */ /* parse optional glyph data */
glyph = (GLYPH_DATA_V2*) xmalloc(sizeof(GLYPH_DATA_V2)); glyph = (GLYPH_DATA_V2*) malloc(sizeof(GLYPH_DATA_V2));
glyph->cacheIndex = fast_glyph->data[0]; glyph->cacheIndex = fast_glyph->data[0];
update_read_2byte_signed(s, &glyph->x); update_read_2byte_signed(s, &glyph->x);
update_read_2byte_signed(s, &glyph->y); update_read_2byte_signed(s, &glyph->y);
@ -1064,7 +1064,7 @@ void update_read_fast_glyph_order(STREAM* s, ORDER_INFO* orderInfo, FAST_GLYPH_O
update_read_2byte_unsigned(s, &glyph->cy); update_read_2byte_unsigned(s, &glyph->cy);
glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy; glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0; glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
glyph->aj = (uint8*) xmalloc(glyph->cb); glyph->aj = (uint8*) malloc(glyph->cb);
stream_read(s, glyph->aj, glyph->cb); stream_read(s, glyph->aj, glyph->cb);
fast_glyph->glyph_data = glyph; fast_glyph->glyph_data = glyph;
} }
@ -1097,9 +1097,9 @@ void update_read_polygon_sc_order(STREAM* s, ORDER_INFO* orderInfo, POLYGON_SC_O
stream_read_uint8(s, polygon_sc->cbData); stream_read_uint8(s, polygon_sc->cbData);
if (polygon_sc->points == NULL) if (polygon_sc->points == NULL)
polygon_sc->points = (DELTA_POINT*) xmalloc(sizeof(DELTA_POINT) * polygon_sc->numPoints); polygon_sc->points = (DELTA_POINT*) malloc(sizeof(DELTA_POINT) * polygon_sc->numPoints);
else else
polygon_sc->points = (DELTA_POINT*) xrealloc(polygon_sc->points, sizeof(DELTA_POINT) * polygon_sc->numPoints); polygon_sc->points = (DELTA_POINT*) realloc(polygon_sc->points, sizeof(DELTA_POINT) * polygon_sc->numPoints);
update_read_delta_points(s, polygon_sc->points, polygon_sc->numPoints, polygon_sc->xStart, polygon_sc->yStart); update_read_delta_points(s, polygon_sc->points, polygon_sc->numPoints, polygon_sc->xStart, polygon_sc->yStart);
} }
@ -1135,9 +1135,9 @@ void update_read_polygon_cb_order(STREAM* s, ORDER_INFO* orderInfo, POLYGON_CB_O
stream_read_uint8(s, polygon_cb->cbData); stream_read_uint8(s, polygon_cb->cbData);
if (polygon_cb->points == NULL) if (polygon_cb->points == NULL)
polygon_cb->points = (DELTA_POINT*) xmalloc(sizeof(DELTA_POINT) * polygon_cb->numPoints); polygon_cb->points = (DELTA_POINT*) malloc(sizeof(DELTA_POINT) * polygon_cb->numPoints);
else else
polygon_cb->points = (DELTA_POINT*) xrealloc(polygon_cb->points, sizeof(DELTA_POINT) * polygon_cb->numPoints); polygon_cb->points = (DELTA_POINT*) realloc(polygon_cb->points, sizeof(DELTA_POINT) * polygon_cb->numPoints);
update_read_delta_points(s, polygon_cb->points, polygon_cb->numPoints, polygon_cb->xStart, polygon_cb->yStart); update_read_delta_points(s, polygon_cb->points, polygon_cb->numPoints, polygon_cb->xStart, polygon_cb->yStart);
} }
@ -1311,9 +1311,9 @@ void update_read_cache_bitmap_v3_order(STREAM* s, CACHE_BITMAP_V3_ORDER* cache_b
stream_read_uint32(s, bitmapData->length); /* length (4 bytes) */ stream_read_uint32(s, bitmapData->length); /* length (4 bytes) */
if (bitmapData->data == NULL) if (bitmapData->data == NULL)
bitmapData->data = (uint8*) xmalloc(bitmapData->length); bitmapData->data = (uint8*) malloc(bitmapData->length);
else else
bitmapData->data = (uint8*) xrealloc(bitmapData->data, bitmapData->length); bitmapData->data = (uint8*) realloc(bitmapData->data, bitmapData->length);
stream_read(s, bitmapData->data, bitmapData->length); stream_read(s, bitmapData->data, bitmapData->length);
} }
@ -1329,9 +1329,9 @@ void update_read_cache_color_table_order(STREAM* s, CACHE_COLOR_TABLE_ORDER* cac
colorTable = cache_color_table_order->colorTable; colorTable = cache_color_table_order->colorTable;
if (colorTable == NULL) if (colorTable == NULL)
colorTable = (uint32*) xmalloc(cache_color_table_order->numberColors * 4); colorTable = (uint32*) malloc(cache_color_table_order->numberColors * 4);
else else
colorTable = (uint32*) xrealloc(colorTable, cache_color_table_order->numberColors * 4); colorTable = (uint32*) realloc(colorTable, cache_color_table_order->numberColors * 4);
for (i = 0; i < (int) cache_color_table_order->numberColors; i++) for (i = 0; i < (int) cache_color_table_order->numberColors; i++)
{ {
@ -1354,7 +1354,7 @@ void update_read_cache_glyph_order(STREAM* s, CACHE_GLYPH_ORDER* cache_glyph_ord
{ {
if (cache_glyph_order->glyphData[i] == NULL) if (cache_glyph_order->glyphData[i] == NULL)
{ {
cache_glyph_order->glyphData[i] = (GLYPH_DATA*) xmalloc(sizeof(GLYPH_DATA)); cache_glyph_order->glyphData[i] = (GLYPH_DATA*) malloc(sizeof(GLYPH_DATA));
} }
glyph = cache_glyph_order->glyphData[i]; glyph = cache_glyph_order->glyphData[i];
@ -1369,7 +1369,7 @@ void update_read_cache_glyph_order(STREAM* s, CACHE_GLYPH_ORDER* cache_glyph_ord
glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy; glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0; glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
glyph->aj = (uint8*) xmalloc(glyph->cb); glyph->aj = (uint8*) malloc(glyph->cb);
stream_read(s, glyph->aj, glyph->cb); stream_read(s, glyph->aj, glyph->cb);
} }
@ -1391,7 +1391,7 @@ void update_read_cache_glyph_v2_order(STREAM* s, CACHE_GLYPH_V2_ORDER* cache_gly
{ {
if (cache_glyph_v2_order->glyphData[i] == NULL) if (cache_glyph_v2_order->glyphData[i] == NULL)
{ {
cache_glyph_v2_order->glyphData[i] = (GLYPH_DATA_V2*) xmalloc(sizeof(GLYPH_DATA_V2)); cache_glyph_v2_order->glyphData[i] = (GLYPH_DATA_V2*) malloc(sizeof(GLYPH_DATA_V2));
} }
glyph = cache_glyph_v2_order->glyphData[i]; glyph = cache_glyph_v2_order->glyphData[i];
@ -1404,7 +1404,7 @@ void update_read_cache_glyph_v2_order(STREAM* s, CACHE_GLYPH_V2_ORDER* cache_gly
glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy; glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0; glyph->cb += ((glyph->cb % 4) > 0) ? 4 - (glyph->cb % 4) : 0;
glyph->aj = (uint8*) xmalloc(glyph->cb); glyph->aj = (uint8*) malloc(glyph->cb);
stream_read(s, glyph->aj, glyph->cb); stream_read(s, glyph->aj, glyph->cb);
} }
@ -1462,7 +1462,7 @@ void update_read_cache_brush_order(STREAM* s, CACHE_BRUSH_ORDER* cache_brush_ord
{ {
size = (cache_brush_order->bpp == 1) ? 8 : 8 * 8 * cache_brush_order->bpp; size = (cache_brush_order->bpp == 1) ? 8 : 8 * 8 * cache_brush_order->bpp;
cache_brush_order->data = (uint8*) xmalloc(size); cache_brush_order->data = (uint8*) malloc(size);
if (cache_brush_order->bpp == 1) if (cache_brush_order->bpp == 1)
{ {
@ -1532,7 +1532,7 @@ void update_read_create_offscreen_bitmap_order(STREAM* s, CREATE_OFFSCREEN_BITMA
if (deleteList->cIndices > deleteList->sIndices) if (deleteList->cIndices > deleteList->sIndices)
{ {
deleteList->sIndices = deleteList->cIndices; deleteList->sIndices = deleteList->cIndices;
deleteList->indices = xrealloc(deleteList->indices, deleteList->sIndices * 2); deleteList->indices = realloc(deleteList->indices, deleteList->sIndices * 2);
} }
for (i = 0; i < (int) deleteList->cIndices; i++) for (i = 0; i < (int) deleteList->cIndices; i++)

View File

@ -415,7 +415,7 @@ void freerdp_peer_free(freerdp_peer* client)
if (client) if (client)
{ {
rdp_free(client->context->rdp); rdp_free(client->context->rdp);
xfree(client->context); free(client->context);
xfree(client); free(client);
} }
} }

View File

@ -966,7 +966,7 @@ void rdp_free(rdpRdp* rdp)
redirection_free(rdp->redirection); redirection_free(rdp->redirection);
mppc_dec_free(rdp->mppc_dec); mppc_dec_free(rdp->mppc_dec);
mppc_enc_free(rdp->mppc_enc); mppc_enc_free(rdp->mppc_enc);
xfree(rdp); free(rdp);
} }
} }

View File

@ -216,10 +216,10 @@ void redirection_free(rdpRedirection* redirection)
for (i = 0; i < (int) redirection->targetNetAddressesCount; i++) for (i = 0; i < (int) redirection->targetNetAddressesCount; i++)
freerdp_string_free(&redirection->targetNetAddresses[i]); freerdp_string_free(&redirection->targetNetAddresses[i]);
xfree(redirection->targetNetAddresses); free(redirection->targetNetAddresses);
} }
xfree(redirection); free(redirection);
} }
} }

View File

@ -104,7 +104,7 @@ boolean ntlm_authenticate(rdpNtlm* ntlm)
ntlm->outputBufferDesc.pBuffers = &ntlm->outputBuffer; ntlm->outputBufferDesc.pBuffers = &ntlm->outputBuffer;
ntlm->outputBuffer.BufferType = SECBUFFER_TOKEN; ntlm->outputBuffer.BufferType = SECBUFFER_TOKEN;
ntlm->outputBuffer.cbBuffer = ntlm->cbMaxToken; ntlm->outputBuffer.cbBuffer = ntlm->cbMaxToken;
ntlm->outputBuffer.pvBuffer = xmalloc(ntlm->outputBuffer.cbBuffer); ntlm->outputBuffer.pvBuffer = malloc(ntlm->outputBuffer.cbBuffer);
if (ntlm->haveInputBuffer) if (ntlm->haveInputBuffer)
{ {
@ -204,7 +204,7 @@ STREAM* rpc_ntlm_http_request(rdpRpc* rpc, SecBuffer* ntlm_token, int content_le
s = http_request_write(http_context, http_request); s = http_request_write(http_context, http_request);
http_request_free(http_request); http_request_free(http_request);
xfree(base64_ntlm_token); free(base64_ntlm_token);
return s; return s;
} }
@ -392,7 +392,7 @@ boolean rpc_send_bind_pdu(rdpRpc* rpc)
bind_pdu->p_context_elem.n_context_elem = 2; bind_pdu->p_context_elem.n_context_elem = 2;
bind_pdu->p_context_elem.reserved = 0; bind_pdu->p_context_elem.reserved = 0;
bind_pdu->p_context_elem.reserved2 = 0; bind_pdu->p_context_elem.reserved2 = 0;
bind_pdu->p_context_elem.p_cont_elem = xmalloc(sizeof(p_cont_elem_t) * bind_pdu->p_context_elem.n_context_elem); bind_pdu->p_context_elem.p_cont_elem = malloc(sizeof(p_cont_elem_t) * bind_pdu->p_context_elem.n_context_elem);
bind_pdu->p_context_elem.p_cont_elem[0].p_cont_id = 0; bind_pdu->p_context_elem.p_cont_elem[0].p_cont_id = 0;
bind_pdu->p_context_elem.p_cont_elem[0].n_transfer_syn = 1; bind_pdu->p_context_elem.p_cont_elem[0].n_transfer_syn = 1;
bind_pdu->p_context_elem.p_cont_elem[0].reserved = 0; bind_pdu->p_context_elem.p_cont_elem[0].reserved = 0;
@ -408,7 +408,7 @@ boolean rpc_send_bind_pdu(rdpRpc* rpc)
bind_pdu->p_context_elem.p_cont_elem[0].abstract_syntax.if_uuid.node[4] = 0x27; bind_pdu->p_context_elem.p_cont_elem[0].abstract_syntax.if_uuid.node[4] = 0x27;
bind_pdu->p_context_elem.p_cont_elem[0].abstract_syntax.if_uuid.node[5] = 0x29; bind_pdu->p_context_elem.p_cont_elem[0].abstract_syntax.if_uuid.node[5] = 0x29;
bind_pdu->p_context_elem.p_cont_elem[0].abstract_syntax.if_version = 0x00030001; bind_pdu->p_context_elem.p_cont_elem[0].abstract_syntax.if_version = 0x00030001;
bind_pdu->p_context_elem.p_cont_elem[0].transfer_syntaxes = xmalloc(sizeof(p_syntax_id_t)); bind_pdu->p_context_elem.p_cont_elem[0].transfer_syntaxes = malloc(sizeof(p_syntax_id_t));
bind_pdu->p_context_elem.p_cont_elem[0].transfer_syntaxes[0].if_uuid.time_low = 0x8a885d04; bind_pdu->p_context_elem.p_cont_elem[0].transfer_syntaxes[0].if_uuid.time_low = 0x8a885d04;
bind_pdu->p_context_elem.p_cont_elem[0].transfer_syntaxes[0].if_uuid.time_mid = 0x1ceb; bind_pdu->p_context_elem.p_cont_elem[0].transfer_syntaxes[0].if_uuid.time_mid = 0x1ceb;
bind_pdu->p_context_elem.p_cont_elem[0].transfer_syntaxes[0].if_uuid.time_hi_and_version = 0x11c9; bind_pdu->p_context_elem.p_cont_elem[0].transfer_syntaxes[0].if_uuid.time_hi_and_version = 0x11c9;
@ -436,7 +436,7 @@ boolean rpc_send_bind_pdu(rdpRpc* rpc)
bind_pdu->p_context_elem.p_cont_elem[1].abstract_syntax.if_uuid.node[4] = 0x27; bind_pdu->p_context_elem.p_cont_elem[1].abstract_syntax.if_uuid.node[4] = 0x27;
bind_pdu->p_context_elem.p_cont_elem[1].abstract_syntax.if_uuid.node[5] = 0x29; bind_pdu->p_context_elem.p_cont_elem[1].abstract_syntax.if_uuid.node[5] = 0x29;
bind_pdu->p_context_elem.p_cont_elem[1].abstract_syntax.if_version = 0x00030001; bind_pdu->p_context_elem.p_cont_elem[1].abstract_syntax.if_version = 0x00030001;
bind_pdu->p_context_elem.p_cont_elem[1].transfer_syntaxes = xmalloc(sizeof(p_syntax_id_t)); bind_pdu->p_context_elem.p_cont_elem[1].transfer_syntaxes = malloc(sizeof(p_syntax_id_t));
bind_pdu->p_context_elem.p_cont_elem[1].transfer_syntaxes[0].if_uuid.time_low = 0x6cb71c2c; bind_pdu->p_context_elem.p_cont_elem[1].transfer_syntaxes[0].if_uuid.time_low = 0x6cb71c2c;
bind_pdu->p_context_elem.p_cont_elem[1].transfer_syntaxes[0].if_uuid.time_mid = 0x9812; bind_pdu->p_context_elem.p_cont_elem[1].transfer_syntaxes[0].if_uuid.time_mid = 0x9812;
bind_pdu->p_context_elem.p_cont_elem[1].transfer_syntaxes[0].if_uuid.time_hi_and_version = 0x4540; bind_pdu->p_context_elem.p_cont_elem[1].transfer_syntaxes[0].if_uuid.time_hi_and_version = 0x4540;
@ -455,7 +455,7 @@ boolean rpc_send_bind_pdu(rdpRpc* rpc)
bind_pdu->auth_verifier.auth_pad_length = 0x00; /* :01 */ bind_pdu->auth_verifier.auth_pad_length = 0x00; /* :01 */
bind_pdu->auth_verifier.auth_reserved = 0x00; /* :01 reserved, m.b.z. */ bind_pdu->auth_verifier.auth_reserved = 0x00; /* :01 reserved, m.b.z. */
bind_pdu->auth_verifier.auth_context_id = 0x00000000; /* :04 */ bind_pdu->auth_verifier.auth_context_id = 0x00000000; /* :04 */
bind_pdu->auth_verifier.auth_value = xmalloc(bind_pdu->auth_length); /* credentials; size_is(auth_length) p*/; bind_pdu->auth_verifier.auth_value = malloc(bind_pdu->auth_length); /* credentials; size_is(auth_length) p*/;
memcpy(bind_pdu->auth_verifier.auth_value, ntlm_stream->data, bind_pdu->auth_length); memcpy(bind_pdu->auth_verifier.auth_value, ntlm_stream->data, bind_pdu->auth_length);
stream_free(ntlm_stream); stream_free(ntlm_stream);
@ -479,7 +479,7 @@ boolean rpc_send_bind_pdu(rdpRpc* rpc)
rpc_in_write(rpc, pdu->data, pdu->size); rpc_in_write(rpc, pdu->data, pdu->size);
stream_free(pdu) ; stream_free(pdu) ;
xfree(bind_pdu); free(bind_pdu);
return true; return true;
} }
@ -494,7 +494,7 @@ int rpc_recv_bind_ack_pdu(rdpRpc* rpc)
RPC_PDU_HEADER header; RPC_PDU_HEADER header;
int pdu_length = 0x8FFF; int pdu_length = 0x8FFF;
pdu = xmalloc(pdu_length); pdu = malloc(pdu_length);
if (pdu == NULL) if (pdu == NULL)
return -1; return -1;
@ -509,11 +509,11 @@ int rpc_recv_bind_ack_pdu(rdpRpc* rpc)
stream_detach(s); stream_detach(s);
stream_free(s); stream_free(s);
auth_data = xmalloc(header.auth_length); auth_data = malloc(header.auth_length);
if (auth_data == NULL) if (auth_data == NULL)
{ {
xfree(pdu); free(pdu);
return -1; return -1;
} }
@ -526,7 +526,7 @@ int rpc_recv_bind_ack_pdu(rdpRpc* rpc)
ntlm_authenticate(rpc->ntlm); ntlm_authenticate(rpc->ntlm);
} }
xfree(pdu); free(pdu);
return status; return status;
} }
@ -562,7 +562,7 @@ boolean rpc_send_rpc_auth_3_pdu(rdpRpc* rpc)
rpc_auth_3_pdu->auth_verifier.auth_pad_length = 0x00; /* :01 */ rpc_auth_3_pdu->auth_verifier.auth_pad_length = 0x00; /* :01 */
rpc_auth_3_pdu->auth_verifier.auth_reserved = 0x00; /* :01 reserved, m.b.z. */ rpc_auth_3_pdu->auth_verifier.auth_reserved = 0x00; /* :01 reserved, m.b.z. */
rpc_auth_3_pdu->auth_verifier.auth_context_id = 0x00000000; /* :04 */ rpc_auth_3_pdu->auth_verifier.auth_context_id = 0x00000000; /* :04 */
rpc_auth_3_pdu->auth_verifier.auth_value = xmalloc(rpc_auth_3_pdu->auth_length); /* credentials; size_is(auth_length) p */ rpc_auth_3_pdu->auth_verifier.auth_value = malloc(rpc_auth_3_pdu->auth_length); /* credentials; size_is(auth_length) p */
memcpy(rpc_auth_3_pdu->auth_verifier.auth_value, s->data, rpc_auth_3_pdu->auth_length); memcpy(rpc_auth_3_pdu->auth_verifier.auth_value, s->data, rpc_auth_3_pdu->auth_length);
stream_free(s); stream_free(s);
@ -580,7 +580,7 @@ boolean rpc_send_rpc_auth_3_pdu(rdpRpc* rpc)
rpc_in_write(rpc, pdu->data, stream_get_length(pdu)); rpc_in_write(rpc, pdu->data, stream_get_length(pdu));
stream_free(pdu) ; stream_free(pdu) ;
xfree(rpc_auth_3_pdu); free(rpc_auth_3_pdu);
return true; return true;
} }
@ -596,7 +596,7 @@ int rpc_out_read(rdpRpc* rpc, uint8* data, int length)
if (rpc->VirtualConnection->DefaultOutChannel->ReceiverAvailableWindow < 0x00008FFF) /* Just a simple workaround */ if (rpc->VirtualConnection->DefaultOutChannel->ReceiverAvailableWindow < 0x00008FFF) /* Just a simple workaround */
rts_send_flow_control_ack_pdu(rpc); /* Send FlowControlAck every time AvailableWindow reaches the half */ rts_send_flow_control_ack_pdu(rpc); /* Send FlowControlAck every time AvailableWindow reaches the half */
pdu = xmalloc(0xFFFF); pdu = malloc(0xFFFF);
if (pdu == NULL) if (pdu == NULL)
{ {
@ -608,7 +608,7 @@ int rpc_out_read(rdpRpc* rpc, uint8* data, int length)
if (status <= 0) if (status <= 0)
{ {
xfree(pdu); free(pdu);
return status; return status;
} }
@ -625,14 +625,14 @@ int rpc_out_read(rdpRpc* rpc, uint8* data, int length)
if (status < 0) if (status < 0)
{ {
xfree(pdu); free(pdu);
return status; return status;
} }
if (header.ptype == PTYPE_RTS) /* RTS PDU */ if (header.ptype == PTYPE_RTS) /* RTS PDU */
{ {
printf("rpc_out_read error: Unexpected RTS PDU\n"); printf("rpc_out_read error: Unexpected RTS PDU\n");
xfree(pdu); free(pdu);
return -1; return -1;
} }
else else
@ -645,7 +645,7 @@ int rpc_out_read(rdpRpc* rpc, uint8* data, int length)
if (length < header.frag_length) if (length < header.frag_length)
{ {
printf("rpc_out_read error! receive buffer is not large enough\n"); printf("rpc_out_read error! receive buffer is not large enough\n");
xfree(pdu); free(pdu);
return -1; return -1;
} }
@ -657,7 +657,7 @@ int rpc_out_read(rdpRpc* rpc, uint8* data, int length)
printf("\n"); printf("\n");
#endif #endif
xfree(pdu); free(pdu);
return header.frag_length; return header.frag_length;
} }
@ -704,7 +704,7 @@ int rpc_tsg_write(rdpRpc* rpc, uint8* data, int length, uint16 opnum)
request_pdu->auth_verifier.auth_type = 0x0A; /* :01 which authentication service */ request_pdu->auth_verifier.auth_type = 0x0A; /* :01 which authentication service */
request_pdu->auth_verifier.auth_level = 0x05; /* :01 which level within service */ request_pdu->auth_verifier.auth_level = 0x05; /* :01 which level within service */
request_pdu->auth_verifier.auth_pad_length = auth_pad_length; /* :01 */ request_pdu->auth_verifier.auth_pad_length = auth_pad_length; /* :01 */
request_pdu->auth_verifier.auth_pad = xmalloc(auth_pad_length); /* align(4); size_is(auth_pad_length) p */ request_pdu->auth_verifier.auth_pad = malloc(auth_pad_length); /* align(4); size_is(auth_pad_length) p */
for (i = 0; i < auth_pad_length; i++) for (i = 0; i < auth_pad_length; i++)
{ {
@ -713,7 +713,7 @@ int rpc_tsg_write(rdpRpc* rpc, uint8* data, int length, uint16 opnum)
request_pdu->auth_verifier.auth_reserved = 0x00; /* :01 reserved, m.b.z. */ request_pdu->auth_verifier.auth_reserved = 0x00; /* :01 reserved, m.b.z. */
request_pdu->auth_verifier.auth_context_id = 0x00000000; /* :04 */ request_pdu->auth_verifier.auth_context_id = 0x00000000; /* :04 */
request_pdu->auth_verifier.auth_value = xmalloc(request_pdu->auth_length); /* credentials; size_is(auth_length) p */ request_pdu->auth_verifier.auth_value = malloc(request_pdu->auth_length); /* credentials; size_is(auth_length) p */
pdu = stream_new(request_pdu->frag_length); pdu = stream_new(request_pdu->frag_length);
@ -725,9 +725,9 @@ int rpc_tsg_write(rdpRpc* rpc, uint8* data, int length, uint16 opnum)
stream_write(pdu, &request_pdu->auth_verifier.auth_type, 8); stream_write(pdu, &request_pdu->auth_verifier.auth_type, 8);
xfree(request_pdu->auth_verifier.auth_value); free(request_pdu->auth_verifier.auth_value);
xfree(request_pdu->auth_verifier.auth_pad); free(request_pdu->auth_verifier.auth_pad);
xfree(request_pdu); free(request_pdu);
if (ntlm->table->QueryContextAttributes(&ntlm->context, SECPKG_ATTR_SIZES, &ntlm->ContextSizes) != SEC_E_OK) if (ntlm->table->QueryContextAttributes(&ntlm->context, SECPKG_ATTR_SIZES, &ntlm->ContextSizes) != SEC_E_OK)
{ {
@ -783,7 +783,7 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length)
uint8 auth_pad_length; uint8 auth_pad_length;
uint32 call_id = -1; uint32 call_id = -1;
int rpc_length = length + 0xFF; int rpc_length = length + 0xFF;
uint8* rpc_data = xmalloc(rpc_length); uint8* rpc_data = malloc(rpc_length);
if (rpc_data == NULL) if (rpc_data == NULL)
{ {
@ -796,13 +796,13 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length)
if (rpc->read_buffer_len > (uint32) length) if (rpc->read_buffer_len > (uint32) length)
{ {
printf("rpc_read error: receiving buffer is not large enough\n"); printf("rpc_read error: receiving buffer is not large enough\n");
xfree(rpc_data); free(rpc_data);
return -1; return -1;
} }
memcpy(data, rpc->read_buffer, rpc->read_buffer_len); memcpy(data, rpc->read_buffer, rpc->read_buffer_len);
read += rpc->read_buffer_len; read += rpc->read_buffer_len;
xfree(rpc->read_buffer); free(rpc->read_buffer);
rpc->read_buffer_len = 0; rpc->read_buffer_len = 0;
} }
@ -812,7 +812,7 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length)
if (status == 0) if (status == 0)
{ {
xfree(rpc_data); free(rpc_data);
return read; return read;
} }
else if (status < 0) else if (status < 0)
@ -821,7 +821,7 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length)
rpc->VirtualConnection->DefaultInChannel->BytesSent, rpc->VirtualConnection->DefaultInChannel->BytesSent,
rpc->VirtualConnection->DefaultOutChannel->BytesReceived); rpc->VirtualConnection->DefaultOutChannel->BytesReceived);
xfree(rpc_data); free(rpc_data);
return status; return status;
} }
@ -840,7 +840,7 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length)
if (read + data_length > length) /* if read data is greater then given buffer */ if (read + data_length > length) /* if read data is greater then given buffer */
{ {
rpc->read_buffer_len = read + data_length - length; rpc->read_buffer_len = read + data_length - length;
rpc->read_buffer = xmalloc(rpc->read_buffer_len); rpc->read_buffer = malloc(rpc->read_buffer_len);
data_length -= rpc->read_buffer_len; data_length -= rpc->read_buffer_len;
@ -857,7 +857,7 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length)
break; break;
} }
xfree(rpc_data); free(rpc_data);
return read; return read;
} }
@ -924,7 +924,7 @@ void rpc_client_virtual_connection_free(RpcVirtualConnection* virtual_connection
{ {
if (virtual_connection != NULL) if (virtual_connection != NULL)
{ {
xfree(virtual_connection); free(virtual_connection);
} }
} }
@ -1018,6 +1018,6 @@ void rpc_free(rdpRpc* rpc)
ntlm_http_free(rpc->ntlm_http_in); ntlm_http_free(rpc->ntlm_http_in);
ntlm_http_free(rpc->ntlm_http_out); ntlm_http_free(rpc->ntlm_http_out);
rpc_client_virtual_connection_free(rpc->VirtualConnection); rpc_client_virtual_connection_free(rpc->VirtualConnection);
xfree(rpc); free(rpc);
} }
} }

View File

@ -688,7 +688,7 @@ int rts_recv_pdu(rdpRpc* rpc, RTS_PDU* rts_pdu)
stream_free(s); stream_free(s);
length = rts_pdu->header.frag_length - 20; length = rts_pdu->header.frag_length - 20;
rts_pdu->content = (uint8*) xmalloc(length); rts_pdu->content = (uint8*) malloc(length);
status = tls_read(tls_out, rts_pdu->content, length); status = tls_read(tls_out, rts_pdu->content, length);

View File

@ -293,34 +293,34 @@ void settings_free(rdpSettings* settings)
{ {
if (settings != NULL) if (settings != NULL)
{ {
xfree(settings->hostname); free(settings->hostname);
xfree(settings->username); free(settings->username);
xfree(settings->password); free(settings->password);
xfree(settings->domain); free(settings->domain);
xfree(settings->shell); free(settings->shell);
xfree(settings->directory); free(settings->directory);
xfree(settings->ip_address); free(settings->ip_address);
xfree(settings->client_dir); free(settings->client_dir);
xfree(settings->cert_file); free(settings->cert_file);
xfree(settings->privatekey_file); free(settings->privatekey_file);
xfree(settings->received_caps); free(settings->received_caps);
xfree(settings->order_support); free(settings->order_support);
xfree(settings->client_hostname); free(settings->client_hostname);
xfree(settings->client_product_id); free(settings->client_product_id);
xfree(settings->server_random); free(settings->server_random);
xfree(settings->server_certificate); free(settings->server_certificate);
xfree(settings->rdp_key_file); free(settings->rdp_key_file);
certificate_free(settings->server_cert); certificate_free(settings->server_cert);
xfree(settings->client_auto_reconnect_cookie); free(settings->client_auto_reconnect_cookie);
xfree(settings->server_auto_reconnect_cookie); free(settings->server_auto_reconnect_cookie);
xfree(settings->client_time_zone); free(settings->client_time_zone);
xfree(settings->bitmapCacheV2CellInfo); free(settings->bitmapCacheV2CellInfo);
xfree(settings->glyphCache); free(settings->glyphCache);
xfree(settings->fragCache); free(settings->fragCache);
key_free(settings->server_key); key_free(settings->server_key);
xfree(settings->config_path); free(settings->config_path);
xfree(settings->current_path); free(settings->current_path);
xfree(settings->development_path); free(settings->development_path);
xfree(settings); free(settings);
} }
} }

View File

@ -257,6 +257,6 @@ void tcp_free(rdpTcp* tcp)
{ {
if (tcp != NULL) if (tcp != NULL)
{ {
xfree(tcp); free(tcp);
} }
} }

View File

@ -90,7 +90,7 @@ boolean rdp_read_client_time_zone(STREAM* s, rdpSettings* settings)
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &str, 64 / 2); freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &str, 64 / 2);
stream_seek(s, 64); stream_seek(s, 64);
strncpy(clientTimeZone->standardName, str, sizeof(clientTimeZone->standardName)); strncpy(clientTimeZone->standardName, str, sizeof(clientTimeZone->standardName));
xfree(str); free(str);
rdp_read_system_time(s, &clientTimeZone->standardDate); /* StandardDate */ rdp_read_system_time(s, &clientTimeZone->standardDate); /* StandardDate */
stream_read_uint32(s, clientTimeZone->standardBias); /* StandardBias */ stream_read_uint32(s, clientTimeZone->standardBias); /* StandardBias */
@ -99,7 +99,7 @@ boolean rdp_read_client_time_zone(STREAM* s, rdpSettings* settings)
freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &str, 64 / 2); freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &str, 64 / 2);
stream_seek(s, 64); stream_seek(s, 64);
strncpy(clientTimeZone->daylightName, str, sizeof(clientTimeZone->daylightName)); strncpy(clientTimeZone->daylightName, str, sizeof(clientTimeZone->daylightName));
xfree(str); free(str);
rdp_read_system_time(s, &clientTimeZone->daylightDate); /* DaylightDate */ rdp_read_system_time(s, &clientTimeZone->daylightDate); /* DaylightDate */
stream_read_uint32(s, clientTimeZone->daylightBias); /* DaylightBias */ stream_read_uint32(s, clientTimeZone->daylightBias); /* DaylightBias */
@ -189,6 +189,6 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings)
stream_write_uint32(s, bias2c); /* DaylightBias */ stream_write_uint32(s, bias2c); /* DaylightBias */
DEBUG_TIMEZONE("DaylightBias=%d", bias2c); DEBUG_TIMEZONE("DaylightBias=%d", bias2c);
xfree(standardName); free(standardName);
xfree(daylightName); free(daylightName);
} }

View File

@ -541,6 +541,6 @@ void transport_free(rdpTransport* transport)
tcp_free(transport->tcp_in); tcp_free(transport->tcp_in);
tsg_free(transport->tsg); tsg_free(transport->tsg);
xfree(transport); free(transport);
} }
} }

View File

@ -492,7 +492,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port)
} }
length = 0x8FFF; length = 0x8FFF;
data = xmalloc(length); data = malloc(length);
if (data == NULL) if (data == NULL)
{ {
printf("rpc_recv - memory allocation error\n") ; printf("rpc_recv - memory allocation error\n") ;
@ -503,7 +503,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port)
if (status <= 0) if (status <= 0)
{ {
printf("rpc_recv failed!\n"); printf("rpc_recv failed!\n");
xfree(data) ; free(data) ;
return false; return false;
} }
@ -534,7 +534,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port)
if (status <= 0) if (status <= 0)
{ {
printf("rpc_write opnum=2 failed!\n"); printf("rpc_write opnum=2 failed!\n");
xfree(data) ; free(data) ;
return false; return false;
} }
@ -543,7 +543,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port)
if (status <= 0) if (status <= 0)
{ {
printf("rpc_recv failed!\n"); printf("rpc_recv failed!\n");
xfree(data) ; free(data) ;
return false; return false;
} }
@ -566,7 +566,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port)
if (status <= 0) if (status <= 0)
{ {
printf("rpc_write opnum=3 failed!\n"); printf("rpc_write opnum=3 failed!\n");
xfree(data) ; free(data) ;
return false; return false;
} }
status = -1; status = -1;
@ -584,7 +584,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port)
stream_write(s_p4, dest_addr_unic, dest_addr_unic_len); stream_write(s_p4, dest_addr_unic, dest_addr_unic_len);
stream_write_uint16(s_p4, 0x0000); /* unicode zero to terminate hostname string */ stream_write_uint16(s_p4, 0x0000); /* unicode zero to terminate hostname string */
xfree(dest_addr_unic); free(dest_addr_unic);
/** /**
* OpNum = 4 * OpNum = 4
@ -604,7 +604,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port)
{ {
printf("rpc_write opnum=4 failed!\n"); printf("rpc_write opnum=4 failed!\n");
stream_free(s_p4); stream_free(s_p4);
xfree(data); free(data);
return false; return false;
} }
@ -614,7 +614,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port)
{ {
printf("rpc_recv failed!\n"); printf("rpc_recv failed!\n");
stream_free(s_p4); stream_free(s_p4);
xfree(data); free(data);
return false; return false;
} }
@ -643,12 +643,12 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port)
{ {
printf("rpc_write opnum=8 failed!\n"); printf("rpc_write opnum=8 failed!\n");
stream_free(s_p4); stream_free(s_p4);
xfree(data); free(data);
return false; return false;
} }
stream_free(s_p4); stream_free(s_p4);
xfree(data); free(data);
return true; return true;
} }
@ -688,6 +688,6 @@ void tsg_free(rdpTsg* tsg)
if (tsg != NULL) if (tsg != NULL)
{ {
rpc_free(tsg->rpc); rpc_free(tsg->rpc);
xfree(tsg); free(tsg);
} }
} }

View File

@ -101,7 +101,7 @@ void update_read_bitmap(rdpUpdate* update, STREAM* s, BITMAP_UPDATE* bitmap_upda
count = bitmap_update->number * 2; count = bitmap_update->number * 2;
bitmap_update->rectangles = (BITMAP_DATA*) xrealloc(bitmap_update->rectangles, bitmap_update->rectangles = (BITMAP_DATA*) realloc(bitmap_update->rectangles,
sizeof(BITMAP_DATA) * count); sizeof(BITMAP_DATA) * count);
memset(&bitmap_update->rectangles[bitmap_update->count], 0, memset(&bitmap_update->rectangles[bitmap_update->count], 0,
@ -195,13 +195,13 @@ void update_read_pointer_color(STREAM* s, POINTER_COLOR_UPDATE* pointer_color)
if (pointer_color->lengthXorMask > 0) if (pointer_color->lengthXorMask > 0)
{ {
pointer_color->xorMaskData = (uint8*) xmalloc(pointer_color->lengthXorMask); pointer_color->xorMaskData = (uint8*) malloc(pointer_color->lengthXorMask);
stream_read(s, pointer_color->xorMaskData, pointer_color->lengthXorMask); stream_read(s, pointer_color->xorMaskData, pointer_color->lengthXorMask);
} }
if (pointer_color->lengthAndMask > 0) if (pointer_color->lengthAndMask > 0)
{ {
pointer_color->andMaskData = (uint8*) xmalloc(pointer_color->lengthAndMask); pointer_color->andMaskData = (uint8*) malloc(pointer_color->lengthAndMask);
stream_read(s, pointer_color->andMaskData, pointer_color->lengthAndMask); stream_read(s, pointer_color->andMaskData, pointer_color->lengthAndMask);
} }
@ -635,7 +635,7 @@ rdpUpdate* update_new(rdpRdp* rdp)
deleteList = &(update->altsec->create_offscreen_bitmap.deleteList); deleteList = &(update->altsec->create_offscreen_bitmap.deleteList);
deleteList->sIndices = 64; deleteList->sIndices = 64;
deleteList->indices = xmalloc(deleteList->sIndices * 2); deleteList->indices = malloc(deleteList->sIndices * 2);
deleteList->cIndices = 0; deleteList->cIndices = 0;
update->SuppressOutput = update_send_suppress_output; update->SuppressOutput = update_send_suppress_output;
@ -650,17 +650,17 @@ void update_free(rdpUpdate* update)
{ {
OFFSCREEN_DELETE_LIST* deleteList; OFFSCREEN_DELETE_LIST* deleteList;
deleteList = &(update->altsec->create_offscreen_bitmap.deleteList); deleteList = &(update->altsec->create_offscreen_bitmap.deleteList);
xfree(deleteList->indices); free(deleteList->indices);
xfree(update->bitmap_update.rectangles); free(update->bitmap_update.rectangles);
xfree(update->pointer); free(update->pointer);
xfree(update->primary->polyline.points); free(update->primary->polyline.points);
xfree(update->primary->polygon_sc.points); free(update->primary->polygon_sc.points);
xfree(update->primary); free(update->primary);
xfree(update->secondary); free(update->secondary);
xfree(update->altsec); free(update->altsec);
xfree(update->window); free(update->window);
xfree(update); free(update);
} }
} }

View File

@ -46,23 +46,23 @@ void update_read_icon_info(STREAM* s, ICON_INFO* icon_info)
/* bitsMask */ /* bitsMask */
if (icon_info->bitsMask == NULL) if (icon_info->bitsMask == NULL)
icon_info->bitsMask = (uint8*) xmalloc(icon_info->cbBitsMask); icon_info->bitsMask = (uint8*) malloc(icon_info->cbBitsMask);
else else
icon_info->bitsMask = (uint8*) xrealloc(icon_info->bitsMask, icon_info->cbBitsMask); icon_info->bitsMask = (uint8*) realloc(icon_info->bitsMask, icon_info->cbBitsMask);
stream_read(s, icon_info->bitsMask, icon_info->cbBitsMask); stream_read(s, icon_info->bitsMask, icon_info->cbBitsMask);
/* colorTable */ /* colorTable */
if (icon_info->colorTable == NULL) if (icon_info->colorTable == NULL)
icon_info->colorTable = (uint8*) xmalloc(icon_info->cbColorTable); icon_info->colorTable = (uint8*) malloc(icon_info->cbColorTable);
else else
icon_info->colorTable = (uint8*) xrealloc(icon_info->colorTable, icon_info->cbColorTable); icon_info->colorTable = (uint8*) realloc(icon_info->colorTable, icon_info->cbColorTable);
stream_read(s, icon_info->colorTable, icon_info->cbColorTable); stream_read(s, icon_info->colorTable, icon_info->cbColorTable);
/* bitsColor */ /* bitsColor */
if (icon_info->bitsColor == NULL) if (icon_info->bitsColor == NULL)
icon_info->bitsColor = (uint8*) xmalloc(icon_info->cbBitsColor); icon_info->bitsColor = (uint8*) malloc(icon_info->cbBitsColor);
else else
icon_info->bitsColor = (uint8*) xrealloc(icon_info->bitsColor, icon_info->cbBitsColor); icon_info->bitsColor = (uint8*) realloc(icon_info->bitsColor, icon_info->cbBitsColor);
stream_read(s, icon_info->bitsColor, icon_info->cbBitsColor); stream_read(s, icon_info->bitsColor, icon_info->cbBitsColor);
} }
@ -141,7 +141,7 @@ void update_read_window_state_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo, WIN
stream_read_uint16(s, window_state->numWindowRects); /* numWindowRects (2 bytes) */ stream_read_uint16(s, window_state->numWindowRects); /* numWindowRects (2 bytes) */
size = sizeof(RECTANGLE_16) * window_state->numWindowRects; size = sizeof(RECTANGLE_16) * window_state->numWindowRects;
window_state->windowRects = (RECTANGLE_16*) xmalloc(size); window_state->windowRects = (RECTANGLE_16*) malloc(size);
/* windowRects */ /* windowRects */
for (i = 0; i < (int) window_state->numWindowRects; i++) for (i = 0; i < (int) window_state->numWindowRects; i++)
@ -164,7 +164,7 @@ void update_read_window_state_order(STREAM* s, WINDOW_ORDER_INFO* orderInfo, WIN
stream_read_uint16(s, window_state->numVisibilityRects); /* numVisibilityRects (2 bytes) */ stream_read_uint16(s, window_state->numVisibilityRects); /* numVisibilityRects (2 bytes) */
size = sizeof(RECTANGLE_16) * window_state->numVisibilityRects; size = sizeof(RECTANGLE_16) * window_state->numVisibilityRects;
window_state->visibilityRects = (RECTANGLE_16*) xmalloc(size); window_state->visibilityRects = (RECTANGLE_16*) malloc(size);
/* visibilityRects */ /* visibilityRects */
for (i = 0; i < (int) window_state->numVisibilityRects; i++) for (i = 0; i < (int) window_state->numVisibilityRects; i++)
@ -297,9 +297,9 @@ void update_read_desktop_actively_monitored_order(STREAM* s, WINDOW_ORDER_INFO*
size = sizeof(uint32) * monitored_desktop->numWindowIds; size = sizeof(uint32) * monitored_desktop->numWindowIds;
if (monitored_desktop->windowIds == NULL) if (monitored_desktop->windowIds == NULL)
monitored_desktop->windowIds = (uint32*) xmalloc(size); monitored_desktop->windowIds = (uint32*) malloc(size);
else else
monitored_desktop->windowIds = (uint32*) xrealloc(monitored_desktop->windowIds, size); monitored_desktop->windowIds = (uint32*) realloc(monitored_desktop->windowIds, size);
/* windowIds */ /* windowIds */
for (i = 0; i < (int) monitored_desktop->numWindowIds; i++) for (i = 0; i < (int) monitored_desktop->numWindowIds; i++)

View File

@ -93,11 +93,11 @@ int certificate_data_match(rdpCertificateStore* certificate_store, rdpCertificat
if (size < 1) if (size < 1)
return match; return match;
data = (char*) xmalloc(size + 2); data = (char*) malloc(size + 2);
if (fread(data, size, 1, fp) != 1) if (fread(data, size, 1, fp) != 1)
{ {
xfree(data); free(data);
return match; return match;
} }
@ -128,7 +128,7 @@ int certificate_data_match(rdpCertificateStore* certificate_store, rdpCertificat
pline = strtok(NULL, "\n"); pline = strtok(NULL, "\n");
} }
xfree(data); free(data);
return match; return match;
} }
@ -154,11 +154,11 @@ void certificate_data_replace(rdpCertificateStore* certificate_store, rdpCertifi
if (size < 1) if (size < 1)
return; return;
data = (char*) xmalloc(size + 2); data = (char*) malloc(size + 2);
if (fread(data, size, 1, fp) != 1) if (fread(data, size, 1, fp) != 1)
{ {
xfree(data); free(data);
return; return;
} }
@ -192,7 +192,7 @@ void certificate_data_replace(rdpCertificateStore* certificate_store, rdpCertifi
} }
fclose(fp); fclose(fp);
xfree(data); free(data);
} }
void certificate_data_print(rdpCertificateStore* certificate_store, rdpCertificateData* certificate_data) void certificate_data_print(rdpCertificateStore* certificate_store, rdpCertificateData* certificate_data)
@ -228,9 +228,9 @@ void certificate_data_free(rdpCertificateData* certificate_data)
{ {
if (certificate_data != NULL) if (certificate_data != NULL)
{ {
xfree(certificate_data->hostname); free(certificate_data->hostname);
xfree(certificate_data->fingerprint); free(certificate_data->fingerprint);
xfree(certificate_data); free(certificate_data);
} }
} }
@ -256,8 +256,8 @@ void certificate_store_free(rdpCertificateStore* certstore)
if (certstore->fp != NULL) if (certstore->fp != NULL)
fclose(certstore->fp); fclose(certstore->fp);
xfree(certstore->path); free(certstore->path);
xfree(certstore->file); free(certstore->file);
xfree(certstore); free(certstore);
} }
} }

View File

@ -25,7 +25,7 @@
CryptoSha1 crypto_sha1_init(void) CryptoSha1 crypto_sha1_init(void)
{ {
CryptoSha1 sha1 = xmalloc(sizeof(*sha1)); CryptoSha1 sha1 = malloc(sizeof(*sha1));
SHA1_Init(&sha1->sha_ctx); SHA1_Init(&sha1->sha_ctx);
return sha1; return sha1;
} }
@ -38,12 +38,12 @@ void crypto_sha1_update(CryptoSha1 sha1, const uint8* data, uint32 length)
void crypto_sha1_final(CryptoSha1 sha1, uint8* out_data) void crypto_sha1_final(CryptoSha1 sha1, uint8* out_data)
{ {
SHA1_Final(out_data, &sha1->sha_ctx); SHA1_Final(out_data, &sha1->sha_ctx);
xfree(sha1); free(sha1);
} }
CryptoMd5 crypto_md5_init(void) CryptoMd5 crypto_md5_init(void)
{ {
CryptoMd5 md5 = xmalloc(sizeof(*md5)); CryptoMd5 md5 = malloc(sizeof(*md5));
MD5_Init(&md5->md5_ctx); MD5_Init(&md5->md5_ctx);
return md5; return md5;
} }
@ -56,12 +56,12 @@ void crypto_md5_update(CryptoMd5 md5, const uint8* data, uint32 length)
void crypto_md5_final(CryptoMd5 md5, uint8* out_data) void crypto_md5_final(CryptoMd5 md5, uint8* out_data)
{ {
MD5_Final(out_data, &md5->md5_ctx); MD5_Final(out_data, &md5->md5_ctx);
xfree(md5); free(md5);
} }
CryptoRc4 crypto_rc4_init(const uint8* key, uint32 length) CryptoRc4 crypto_rc4_init(const uint8* key, uint32 length)
{ {
CryptoRc4 rc4 = xmalloc(sizeof(*rc4)); CryptoRc4 rc4 = malloc(sizeof(*rc4));
RC4_set_key(&rc4->rc4_key, length, key); RC4_set_key(&rc4->rc4_key, length, key);
return rc4; return rc4;
} }
@ -74,12 +74,12 @@ void crypto_rc4(CryptoRc4 rc4, uint32 length, const uint8* in_data, uint8* out_d
void crypto_rc4_free(CryptoRc4 rc4) void crypto_rc4_free(CryptoRc4 rc4)
{ {
if (rc4) if (rc4)
xfree(rc4); free(rc4);
} }
CryptoDes3 crypto_des3_encrypt_init(const uint8* key, const uint8* ivec) CryptoDes3 crypto_des3_encrypt_init(const uint8* key, const uint8* ivec)
{ {
CryptoDes3 des3 = xmalloc(sizeof(*des3)); CryptoDes3 des3 = malloc(sizeof(*des3));
EVP_CIPHER_CTX_init(&des3->des3_ctx); EVP_CIPHER_CTX_init(&des3->des3_ctx);
EVP_EncryptInit_ex(&des3->des3_ctx, EVP_des_ede3_cbc(), NULL, key, ivec); EVP_EncryptInit_ex(&des3->des3_ctx, EVP_des_ede3_cbc(), NULL, key, ivec);
EVP_CIPHER_CTX_set_padding(&des3->des3_ctx, 0); EVP_CIPHER_CTX_set_padding(&des3->des3_ctx, 0);
@ -88,7 +88,7 @@ CryptoDes3 crypto_des3_encrypt_init(const uint8* key, const uint8* ivec)
CryptoDes3 crypto_des3_decrypt_init(const uint8* key, const uint8* ivec) CryptoDes3 crypto_des3_decrypt_init(const uint8* key, const uint8* ivec)
{ {
CryptoDes3 des3 = xmalloc(sizeof(*des3)); CryptoDes3 des3 = malloc(sizeof(*des3));
EVP_CIPHER_CTX_init(&des3->des3_ctx); EVP_CIPHER_CTX_init(&des3->des3_ctx);
EVP_DecryptInit_ex(&des3->des3_ctx, EVP_des_ede3_cbc(), NULL, key, ivec); EVP_DecryptInit_ex(&des3->des3_ctx, EVP_des_ede3_cbc(), NULL, key, ivec);
EVP_CIPHER_CTX_set_padding(&des3->des3_ctx, 0); EVP_CIPHER_CTX_set_padding(&des3->des3_ctx, 0);
@ -115,12 +115,12 @@ void crypto_des3_free(CryptoDes3 des3)
if (des3 == NULL) if (des3 == NULL)
return; return;
EVP_CIPHER_CTX_cleanup(&des3->des3_ctx); EVP_CIPHER_CTX_cleanup(&des3->des3_ctx);
xfree(des3); free(des3);
} }
CryptoHmac crypto_hmac_new(void) CryptoHmac crypto_hmac_new(void)
{ {
CryptoHmac hmac = xmalloc(sizeof(*hmac)); CryptoHmac hmac = malloc(sizeof(*hmac));
HMAC_CTX_init(&hmac->hmac_ctx); HMAC_CTX_init(&hmac->hmac_ctx);
return hmac; return hmac;
} }
@ -145,12 +145,12 @@ void crypto_hmac_free(CryptoHmac hmac)
if (hmac == NULL) if (hmac == NULL)
return; return;
HMAC_CTX_cleanup(&hmac->hmac_ctx); HMAC_CTX_cleanup(&hmac->hmac_ctx);
xfree(hmac); free(hmac);
} }
CryptoCert crypto_cert_read(uint8* data, uint32 length) CryptoCert crypto_cert_read(uint8* data, uint32 length)
{ {
CryptoCert cert = xmalloc(sizeof(*cert)); CryptoCert cert = malloc(sizeof(*cert));
/* this will move the data pointer but we don't care, we don't use it again */ /* this will move the data pointer but we don't care, we don't use it again */
cert->px509 = d2i_X509(NULL, (D2I_X509_CONST uint8 **) &data, length); cert->px509 = d2i_X509(NULL, (D2I_X509_CONST uint8 **) &data, length);
return cert; return cert;
@ -163,7 +163,7 @@ void crypto_cert_free(CryptoCert cert)
X509_free(cert->px509); X509_free(cert->px509);
xfree(cert); free(cert);
} }
boolean crypto_cert_get_public_key(CryptoCert cert, BYTE** PublicKey, DWORD* PublicKeyLength) boolean crypto_cert_get_public_key(CryptoCert cert, BYTE** PublicKey, DWORD* PublicKeyLength)
@ -213,7 +213,7 @@ static void crypto_rsa_common(const uint8* input, int length, uint32 key_length,
uint8* exponent_reverse; uint8* exponent_reverse;
BIGNUM mod, exp, x, y; BIGNUM mod, exp, x, y;
input_reverse = (uint8*) xmalloc(2 * key_length + exponent_size); input_reverse = (uint8*) malloc(2 * key_length + exponent_size);
modulus_reverse = input_reverse + key_length; modulus_reverse = input_reverse + key_length;
exponent_reverse = modulus_reverse + key_length; exponent_reverse = modulus_reverse + key_length;
@ -246,7 +246,7 @@ static void crypto_rsa_common(const uint8* input, int length, uint32 key_length,
BN_free(&exp); BN_free(&exp);
BN_free(&mod); BN_free(&mod);
BN_CTX_free(ctx); BN_CTX_free(ctx);
xfree(input_reverse); free(input_reverse);
} }
static void crypto_rsa_public(const uint8* input, int length, uint32 key_length, const uint8* modulus, const uint8* exponent, uint8* output) static void crypto_rsa_public(const uint8* input, int length, uint32 key_length, const uint8* modulus, const uint8* exponent, uint8* output)
@ -407,8 +407,8 @@ char** crypto_cert_subject_alt_name(X509* xcert, int* count, int** lengths)
return NULL; return NULL;
num_subject_alt_names = sk_GENERAL_NAME_num(subject_alt_names); num_subject_alt_names = sk_GENERAL_NAME_num(subject_alt_names);
strings = (char**) xmalloc(sizeof(char*) * num_subject_alt_names); strings = (char**) malloc(sizeof(char*) * num_subject_alt_names);
*lengths = (int*) xmalloc(sizeof(int*) * num_subject_alt_names); *lengths = (int*) malloc(sizeof(int*) * num_subject_alt_names);
for (index = 0; index < num_subject_alt_names; ++index) for (index = 0; index < num_subject_alt_names; ++index)
{ {
@ -425,8 +425,8 @@ char** crypto_cert_subject_alt_name(X509* xcert, int* count, int** lengths)
if (*count < 1) if (*count < 1)
{ {
xfree(strings) ; free(strings) ;
xfree(*lengths) ; free(*lengths) ;
*lengths = NULL ; *lengths = NULL ;
return NULL; return NULL;
} }
@ -497,7 +497,7 @@ rdpCertificateData* crypto_get_certificate_data(X509* xcert, char* hostname)
fp = crypto_cert_fingerprint(xcert); fp = crypto_cert_fingerprint(xcert);
certdata = certificate_data_new(hostname, fp); certdata = certificate_data_new(hostname, fp);
xfree(fp); free(fp);
return certdata; return certdata;
} }
@ -520,9 +520,9 @@ void crypto_cert_print_info(X509* xcert)
"the CA certificate in your certificate store, or the certificate has expired. " "the CA certificate in your certificate store, or the certificate has expired. "
"Please look at the documentation on how to create local certificate store for a private CA.\n"); "Please look at the documentation on how to create local certificate store for a private CA.\n");
xfree(subject); free(subject);
xfree(issuer); free(issuer);
xfree(fp); free(fp);
} }
char* crypto_base64_encode(uint8* data, int length) char* crypto_base64_encode(uint8* data, int length)
@ -543,7 +543,7 @@ char* crypto_base64_encode(uint8* data, int length)
BIO_get_mem_ptr(b64, &bptr); BIO_get_mem_ptr(b64, &bptr);
base64_string = xmalloc(bptr->length); base64_string = malloc(bptr->length);
memcpy(base64_string, bptr->data, bptr->length - 1); memcpy(base64_string, bptr->data, bptr->length - 1);
base64_string[bptr->length - 1] = '\0'; base64_string[bptr->length - 1] = '\0';
@ -556,7 +556,7 @@ void crypto_base64_decode(uint8* enc_data, int length, uint8** dec_data, int* re
{ {
BIO *b64, *bmem; BIO *b64, *bmem;
*dec_data = xmalloc(length); *dec_data = malloc(length);
memset(*dec_data, 0, length); memset(*dec_data, 0, length);
b64 = BIO_new(BIO_f_base64()); b64 = BIO_new(BIO_f_base64());

View File

@ -43,7 +43,7 @@ static CryptoCert tls_get_certificate(rdpTls* tls, boolean peer)
} }
else else
{ {
cert = xmalloc(sizeof(*cert)); cert = malloc(sizeof(*cert));
cert->px509 = server_cert; cert->px509 = server_cert;
} }
@ -53,7 +53,7 @@ static CryptoCert tls_get_certificate(rdpTls* tls, boolean peer)
static void tls_free_certificate(CryptoCert cert) static void tls_free_certificate(CryptoCert cert)
{ {
X509_free(cert->px509); X509_free(cert->px509);
xfree(cert); free(cert);
} }
boolean tls_connect(rdpTls* tls) boolean tls_connect(rdpTls* tls)
@ -241,7 +241,7 @@ boolean tls_accept(rdpTls* tls, const char* cert_file, const char* privatekey_fi
return false; return false;
} }
xfree(cert); free(cert);
if (SSL_set_fd(tls->ssl, tls->sockfd) < 1) if (SSL_set_fd(tls->ssl, tls->sockfd) < 1)
{ {
@ -476,7 +476,7 @@ boolean tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname)
{ {
if (common_name) if (common_name)
{ {
xfree(common_name); free(common_name);
common_name = NULL; common_name = NULL;
} }
@ -550,16 +550,16 @@ boolean tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname)
verification_status = true; /* success! */ verification_status = true; /* success! */
} }
xfree(issuer); free(issuer);
xfree(subject); free(subject);
xfree(fingerprint); free(fingerprint);
} }
if (certificate_data) if (certificate_data)
{ {
xfree(certificate_data->fingerprint); free(certificate_data->fingerprint);
xfree(certificate_data->hostname); free(certificate_data->hostname);
xfree(certificate_data); free(certificate_data);
} }
return verification_status; return verification_status;
@ -644,6 +644,6 @@ void tls_free(rdpTls* tls)
certificate_store_free(tls->certificate_store); certificate_store_free(tls->certificate_store);
xfree(tls); free(tls);
} }
} }

View File

@ -136,7 +136,7 @@ INLINE void gdi_SetPixel_32bpp(HGDI_BITMAP hBmp, int X, int Y, uint32 pixel)
HGDI_BITMAP gdi_CreateBitmap(int nWidth, int nHeight, int cBitsPerPixel, uint8* data) HGDI_BITMAP gdi_CreateBitmap(int nWidth, int nHeight, int cBitsPerPixel, uint8* data)
{ {
HGDI_BITMAP hBitmap = (HGDI_BITMAP) xmalloc(sizeof(GDI_BITMAP)); HGDI_BITMAP hBitmap = (HGDI_BITMAP) malloc(sizeof(GDI_BITMAP));
hBitmap->objectType = GDIOBJECT_BITMAP; hBitmap->objectType = GDIOBJECT_BITMAP;
hBitmap->bitsPerPixel = cBitsPerPixel; hBitmap->bitsPerPixel = cBitsPerPixel;
hBitmap->bytesPerPixel = (cBitsPerPixel + 1) / 8; hBitmap->bytesPerPixel = (cBitsPerPixel + 1) / 8;
@ -158,13 +158,13 @@ HGDI_BITMAP gdi_CreateBitmap(int nWidth, int nHeight, int cBitsPerPixel, uint8*
HGDI_BITMAP gdi_CreateCompatibleBitmap(HGDI_DC hdc, int nWidth, int nHeight) HGDI_BITMAP gdi_CreateCompatibleBitmap(HGDI_DC hdc, int nWidth, int nHeight)
{ {
HGDI_BITMAP hBitmap = (HGDI_BITMAP) xmalloc(sizeof(GDI_BITMAP)); HGDI_BITMAP hBitmap = (HGDI_BITMAP) malloc(sizeof(GDI_BITMAP));
hBitmap->objectType = GDIOBJECT_BITMAP; hBitmap->objectType = GDIOBJECT_BITMAP;
hBitmap->bytesPerPixel = hdc->bytesPerPixel; hBitmap->bytesPerPixel = hdc->bytesPerPixel;
hBitmap->bitsPerPixel = hdc->bitsPerPixel; hBitmap->bitsPerPixel = hdc->bitsPerPixel;
hBitmap->width = nWidth; hBitmap->width = nWidth;
hBitmap->height = nHeight; hBitmap->height = nHeight;
hBitmap->data = xmalloc(nWidth * nHeight * hBitmap->bytesPerPixel); hBitmap->data = malloc(nWidth * nHeight * hBitmap->bytesPerPixel);
hBitmap->scanline = nWidth * hBitmap->bytesPerPixel; hBitmap->scanline = nWidth * hBitmap->bytesPerPixel;
return hBitmap; return hBitmap;
} }

Some files were not shown because too many files have changed in this diff Show More