diff --git a/channels/audin/client/alsa/audin_alsa.c b/channels/audin/client/alsa/audin_alsa.c index 0b6e40468..4183b6187 100644 --- a/channels/audin/client/alsa/audin_alsa.c +++ b/channels/audin/client/alsa/audin_alsa.c @@ -217,8 +217,8 @@ static void* audin_alsa_thread_func(void* arg) } } while (0); - xfree(buffer); - xfree(alsa->buffer); + free(buffer); + free(alsa->buffer); alsa->buffer = NULL; if (capture_handle) snd_pcm_close(capture_handle); @@ -236,7 +236,7 @@ static void audin_alsa_free(IAudinDevice* device) freerdp_thread_free(alsa->thread); freerdp_dsp_context_free(alsa->dsp_context); - xfree(alsa); + free(alsa); } static boolean audin_alsa_format_supported(IAudinDevice* device, audinFormat* format) diff --git a/channels/audin/client/audin_main.c b/channels/audin/client/audin_main.c index e24d2c205..c63adc90e 100644 --- a/channels/audin/client/audin_main.c +++ b/channels/audin/client/audin_main.c @@ -358,8 +358,8 @@ static int audin_on_close(IWTSVirtualChannelCallback* pChannelCallback) if (audin->device) IFCALL(audin->device->Close, audin->device); - xfree(callback->formats); - xfree(callback); + free(callback->formats); + free(callback); return 0; } @@ -415,8 +415,8 @@ static int audin_plugin_terminated(IWTSPlugin* pPlugin) audin->device = NULL; } - xfree(audin->listener_callback); - xfree(audin); + free(audin->listener_callback); + free(audin); return 0; } @@ -452,7 +452,7 @@ static boolean audin_load_device_plugin(IWTSPlugin* pPlugin, const char* name, R strcpy(fullname, "audin_"); strcat(fullname, name); entry = (PFREERDP_AUDIN_DEVICE_ENTRY) freerdp_load_plugin(fullname, AUDIN_DEVICE_EXPORT_FUNC_NAME); - xfree(fullname); + free(fullname); } if (entry == NULL) diff --git a/channels/audin/client/pulse/audin_pulse.c b/channels/audin/client/pulse/audin_pulse.c index cf6c1f96e..1ab856595 100644 --- a/channels/audin/client/pulse/audin_pulse.c +++ b/channels/audin/client/pulse/audin_pulse.c @@ -152,7 +152,7 @@ static void audin_pulse_free(IAudinDevice* device) pulse->mainloop = NULL; } freerdp_dsp_context_free(pulse->dsp_context); - xfree(pulse); + free(pulse); } 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; if (pulse->buffer) { - xfree(pulse->buffer); + free(pulse->buffer); pulse->buffer = NULL; pulse->buffer_frames = 0; } diff --git a/channels/audin/server/audin.c b/channels/audin/server/audin.c index 4bedf4776..f244c9934 100644 --- a/channels/audin/server/audin.c +++ b/channels/audin/server/audin.c @@ -139,7 +139,7 @@ static boolean audin_server_recv_formats(audin_server* audin, STREAM* s, uint32 { if (length < 18) { - xfree(audin->context.client_formats); + free(audin->context.client_formats); audin->context.client_formats = NULL; return false; } @@ -431,6 +431,6 @@ void audin_server_context_free(audin_server_context* context) if (audin->dsp_context) freerdp_dsp_context_free(audin->dsp_context); if (audin->context.client_formats) - xfree(audin->context.client_formats); - xfree(audin); + free(audin->context.client_formats); + free(audin); } diff --git a/channels/cliprdr/client/cliprdr_format.c b/channels/cliprdr/client/cliprdr_format.c index c01a5453d..119e41798 100644 --- a/channels/cliprdr/client/cliprdr_format.c +++ b/channels/cliprdr/client/cliprdr_format.c @@ -127,7 +127,7 @@ void cliprdr_process_short_format_names(cliprdrPlugin* cliprdr, STREAM* s, uint3 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; 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); 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; 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) { 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); } @@ -204,7 +204,7 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataL 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); 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); 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; @@ -271,10 +271,10 @@ void cliprdr_process_format_list(cliprdrPlugin* cliprdr, STREAM* s, uint32 dataL cb_event->formats[cb_event->num_formats++] = format; 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->num_format_names = 0; @@ -348,7 +348,7 @@ void cliprdr_process_format_data_response(cliprdrPlugin* cliprdr, STREAM* s, uin if (dataLen > 0) { 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); } diff --git a/channels/cliprdr/client/cliprdr_main.c b/channels/cliprdr/client/cliprdr_main.c index b12e84e76..f91cd38f4 100644 --- a/channels/cliprdr/client/cliprdr_main.c +++ b/channels/cliprdr/client/cliprdr_main.c @@ -268,7 +268,7 @@ static void cliprdr_process_event(rdpSvcPlugin* plugin, RDP_EVENT* event) static void cliprdr_process_terminate(rdpSvcPlugin* plugin) { - xfree(plugin); + free(plugin); } /* cliprdr is always built-in */ diff --git a/channels/disk/client/disk_file.c b/channels/disk/client/disk_file.c index a26a6e1bb..e05b925f8 100644 --- a/channels/disk/client/disk_file.c +++ b/channels/disk/client/disk_file.c @@ -190,7 +190,7 @@ static boolean disk_file_remove_dir(const char* path) static void disk_file_set_fullpath(DISK_FILE* file, char* fullpath) { - xfree(file->fullpath); + free(file->fullpath); file->fullpath = fullpath; file->filename = strrchr(file->fullpath, '/'); @@ -341,9 +341,9 @@ void disk_file_free(DISK_FILE* file) unlink(file->fullpath); } - xfree(file->pattern); - xfree(file->fullpath); - xfree(file); + free(file->pattern); + free(file->fullpath); + free(file); } 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); fullpath = disk_file_combine_fullpath(file->basepath, s); - xfree(s); + free(s); /* TODO rename does not work on win32 */ if (rename(file->fullpath, fullpath) == 0) @@ -562,7 +562,7 @@ boolean disk_file_query_directory(DISK_FILE* file, uint32 FsInformationClass, ui if (InitialQuery != 0) { rewinddir(file->dir); - xfree(file->pattern); + free(file->pattern); if (path[0]) 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); - xfree(ent_path); + free(ent_path); 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; } - xfree(ent_path); + free(ent_path); return ret; } diff --git a/channels/disk/client/disk_main.c b/channels/disk/client/disk_main.c index fee279fa9..9a216487a 100644 --- a/channels/disk/client/disk_main.c +++ b/channels/disk/client/disk_main.c @@ -186,7 +186,7 @@ static void disk_process_irp_create(DISK_DEVICE* disk, IRP* irp) stream_write_uint32(irp->output, FileId); stream_write_uint8(irp->output, Information); - xfree(path); + free(path); irp->Complete(irp); } @@ -244,11 +244,11 @@ static void disk_process_irp_read(DISK_DEVICE* disk, IRP* irp) } else { - buffer = (uint8*) xmalloc(Length); + buffer = (uint8*) malloc(Length); if (!disk_file_read(file, buffer, &Length)) { irp->IoStatus = STATUS_UNSUCCESSFUL; - xfree(buffer); + free(buffer); buffer = NULL; Length = 0; @@ -268,7 +268,7 @@ static void disk_process_irp_read(DISK_DEVICE* disk, IRP* irp) stream_write(irp->output, buffer, Length); } - xfree(buffer); + free(buffer); 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 */ /* Reserved(1), MUST NOT be added! */ stream_write(output, outStr, length); /* VolumeLabel (Unicode) */ - xfree(outStr); + free(outStr); break; 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, length); /* FileSystemNameLength */ stream_write(output, outStr, length); /* FileSystemName (Unicode) */ - xfree(outStr); + free(outStr); break; case FileFsFullSizeInformation: @@ -494,7 +494,7 @@ static void disk_process_irp_query_directory(DISK_DEVICE* disk, IRP* irp) irp->IoStatus = STATUS_NO_MORE_FILES; } - xfree(path); + free(path); irp->Complete(irp); } @@ -640,7 +640,7 @@ static void disk_free(DEVICE* device) disk_file_free(file); list_free(disk->files); - xfree(disk); + free(disk); } void disk_register_disk_path(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, char* name, char* path) diff --git a/channels/drdynvc/client/drdynvc_main.c b/channels/drdynvc/client/drdynvc_main.c index f5e575484..c1cca1e01 100644 --- a/channels/drdynvc/client/drdynvc_main.c +++ b/channels/drdynvc/client/drdynvc_main.c @@ -362,7 +362,7 @@ static void drdynvc_process_terminate(rdpSvcPlugin* plugin) if (drdynvc->channel_mgr != NULL) dvcman_free(drdynvc->channel_mgr); - xfree(drdynvc); + free(drdynvc); } /* drdynvc is always built-in */ diff --git a/channels/drdynvc/client/dvcman.c b/channels/drdynvc/client/dvcman.c index c584c0104..f87aa935c 100644 --- a/channels/drdynvc/client/dvcman.c +++ b/channels/drdynvc/client/dvcman.c @@ -251,7 +251,7 @@ static void dvcman_channel_free(DVCMAN_CHANNEL* channel) if (channel->channel_callback) channel->channel_callback->OnClose(channel->channel_callback); - xfree(channel); + free(channel); } void dvcman_free(IWTSVirtualChannelManager* pChannelMgr) @@ -270,8 +270,8 @@ void dvcman_free(IWTSVirtualChannelManager* pChannelMgr) for (i = 0; i < dvcman->num_listeners; i++) { listener = (DVCMAN_LISTENER*) dvcman->listeners[i]; - xfree(listener->channel_name); - xfree(listener); + free(listener->channel_name); + free(listener); } for (i = 0; i < dvcman->num_plugins; i++) @@ -282,7 +282,7 @@ void dvcman_free(IWTSVirtualChannelManager* pChannelMgr) pPlugin->Terminated(pPlugin); } - xfree(dvcman); + free(dvcman); } int dvcman_init(IWTSVirtualChannelManager* pChannelMgr) diff --git a/channels/parallel/client/parallel_main.c b/channels/parallel/client/parallel_main.c index 46b92ae42..9f5f3fd5f 100644 --- a/channels/parallel/client/parallel_main.c +++ b/channels/parallel/client/parallel_main.c @@ -106,7 +106,7 @@ static void parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp) stream_write_uint32(irp->output, parallel->id); stream_write_uint8(irp->output, 0); - xfree(path); + free(path); 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_uint64(irp->input, Offset); - buffer = (uint8*) xmalloc(Length); + buffer = (uint8*) malloc(Length); status = read(parallel->file, irp->output->p, Length); if (status < 0) { irp->IoStatus = STATUS_UNSUCCESSFUL; - xfree(buffer); + free(buffer); buffer = NULL; Length = 0; @@ -157,7 +157,7 @@ static void parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp) stream_check_size(irp->output, Length); stream_write(irp->output, buffer, Length); } - xfree(buffer); + free(buffer); irp->Complete(irp); } @@ -304,7 +304,7 @@ static void parallel_free(DEVICE* device) _aligned_free(parallel->pIrpList); - xfree(parallel); + free(parallel); } int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) diff --git a/channels/printer/client/printer_cups.c b/channels/printer/client/printer_cups.c index a6a076b10..296ed78db 100644 --- a/channels/printer/client/printer_cups.c +++ b/channels/printer/client/printer_cups.c @@ -119,7 +119,7 @@ static void printer_cups_close_printjob(rdpPrintJob* printjob) DEBUG_WARN("cupsPrintFile: %s", cupsLastErrorString()); } unlink(cups_printjob->printjob_object); - xfree(cups_printjob->printjob_object); + free(cups_printjob->printjob_object); } #else @@ -131,7 +131,7 @@ static void printer_cups_close_printjob(rdpPrintJob* printjob) #endif ((rdpCupsPrinter*)printjob->printer)->printjob = NULL; - xfree(cups_printjob) ; + free(cups_printjob) ; } 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) { DEBUG_WARN("httpConnectEncrypt: %s", cupsLastErrorString()); - xfree(cups_printjob); + free(cups_printjob); return NULL; } @@ -174,7 +174,7 @@ static rdpPrintJob* printer_cups_create_printjob(rdpPrinter* printer, uint32 id) { DEBUG_WARN("cupsCreateJob: %s", cupsLastErrorString()); httpClose((http_t*)cups_printjob->printjob_object); - xfree(cups_printjob); + free(cups_printjob); return NULL; } cupsStartDocument((http_t*)cups_printjob->printjob_object, @@ -207,8 +207,8 @@ static void printer_cups_free_printer(rdpPrinter* printer) if (cups_printer->printjob) cups_printer->printjob->printjob.Close((rdpPrintJob*)cups_printer->printjob); - xfree(printer->name); - xfree(printer); + free(printer->name); + free(printer); } static rdpPrinter* printer_cups_new_printer(rdpCupsPrinterDriver* cups_driver, const char* name, boolean is_default) diff --git a/channels/printer/client/printer_main.c b/channels/printer/client/printer_main.c index 275c5c7a3..2b63203c7 100644 --- a/channels/printer/client/printer_main.c +++ b/channels/printer/client/printer_main.c @@ -227,9 +227,9 @@ static void printer_free(DEVICE* device) if (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) @@ -244,7 +244,7 @@ void printer_register(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints, rdpPrinter* pri uint8* CachedPrinterConfigData; PRINTER_DEVICE* printer_dev; - port = xmalloc(10); + port = malloc(10); snprintf(port, 10, "PRN%d", printer->id); 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); } - xfree(DriverName); - xfree(PrintName); + free(DriverName); + free(PrintName); printer_dev->pIrpList = (PSLIST_HEADER) _aligned_malloc(sizeof(SLIST_HEADER), MEMORY_ALLOCATION_ALIGNMENT); InitializeSListHead(printer_dev->pIrpList); @@ -354,7 +354,7 @@ int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) printer_register(pEntryPoints, printer); } - xfree(printers); + free(printers); } return 0; diff --git a/channels/printer/client/printer_win.c b/channels/printer/client/printer_win.c index be80a19d2..a7db9c94c 100644 --- a/channels/printer/client/printer_win.c +++ b/channels/printer/client/printer_win.c @@ -104,7 +104,7 @@ static void printer_win_close_printjob(rdpPrintJob* printjob) DEBUG_WINPR("ClosePrinter failed");; ((rdpWinPrinter*)printjob->printer)->printjob = NULL; - xfree(win_printjob) ; + free(win_printjob) ; } 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) win_printer->printjob->printjob.Close((rdpPrintJob*)win_printer->printjob); - xfree(printer->name); - xfree(printer); + free(printer->name); + free(printer); } 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); 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); return (rdpPrinter*)win_printer; diff --git a/channels/rail/client/rail_orders.c b/channels/rail/client/rail_orders.c index 5ff45fab6..d24178a8d 100644 --- a/channels/rail/client/rail_orders.c +++ b/channels/rail/client/rail_orders.c @@ -22,8 +22,12 @@ #include "config.h" #endif +#include +#include + +#include + #include -#include #include #include "rail_orders.h" @@ -71,7 +75,7 @@ void rail_string_to_unicode_string(rdpRailOrder* rail_order, char* string, RAIL_ int length = 0; if (unicode_string->string != NULL) - xfree(unicode_string->string); + free(unicode_string->string); unicode_string->string = NULL; 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); rail_write_langbar_info_order(s, &rail_order->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; - rail_order = xnew(rdpRailOrder); + rail_order = (rdpRailOrder*) malloc(sizeof(rdpRailOrder)); + ZeroMemory(rail_order, sizeof(rdpRailOrder)); if (rail_order != NULL) { @@ -652,7 +657,7 @@ void rail_order_free(rdpRailOrder* rail_order) if (rail_order != NULL) { - xfree(rail_order); + free(rail_order); } } diff --git a/channels/rdpdr/client/devman.c b/channels/rdpdr/client/devman.c index 1ec48401d..eab0feb33 100644 --- a/channels/rdpdr/client/devman.c +++ b/channels/rdpdr/client/devman.c @@ -58,7 +58,7 @@ void devman_free(DEVMAN* devman) list_free(devman->devices); - xfree(devman); + free(devman); } static void devman_register_device(DEVMAN* devman, DEVICE* device) diff --git a/channels/rdpdr/client/rdpdr_main.c b/channels/rdpdr/client/rdpdr_main.c index a41b980f1..e398b33ca 100644 --- a/channels/rdpdr/client/rdpdr_main.c +++ b/channels/rdpdr/client/rdpdr_main.c @@ -118,7 +118,7 @@ static void rdpdr_send_client_name_request(rdpdrPlugin* rdpdr) stream_write(data_out, computerNameW, computerNameLenW); stream_write_uint16(data_out, 0); /* null terminator */ - xfree(computerNameW); + free(computerNameW); svc_plugin_send((rdpSvcPlugin*) rdpdr, data_out); } @@ -313,7 +313,7 @@ static void rdpdr_process_terminate(rdpSvcPlugin* plugin) rdpdrPlugin* rdpdr = (rdpdrPlugin*) plugin; devman_free(rdpdr->devman); - xfree(plugin); + free(plugin); } /* rdpdr is always built-in */ diff --git a/channels/rdpsnd/client/alsa/rdpsnd_alsa.c b/channels/rdpsnd/client/alsa/rdpsnd_alsa.c index ac2db4329..26326bbba 100644 --- a/channels/rdpsnd/client/alsa/rdpsnd_alsa.c +++ b/channels/rdpsnd/client/alsa/rdpsnd_alsa.c @@ -257,9 +257,9 @@ static void rdpsnd_alsa_free(rdpsndDevicePlugin* device) rdpsndAlsaPlugin* alsa = (rdpsndAlsaPlugin*)device; rdpsnd_alsa_close(device); - xfree(alsa->device_name); + free(alsa->device_name); freerdp_dsp_context_free(alsa->dsp_context); - xfree(alsa); + free(alsa); } static boolean rdpsnd_alsa_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format) diff --git a/channels/rdpsnd/client/pulse/rdpsnd_pulse.c b/channels/rdpsnd/client/pulse/rdpsnd_pulse.c index 456fc1130..702f2d49c 100644 --- a/channels/rdpsnd/client/pulse/rdpsnd_pulse.c +++ b/channels/rdpsnd/client/pulse/rdpsnd_pulse.c @@ -357,9 +357,9 @@ static void rdpsnd_pulse_free(rdpsndDevicePlugin* device) pulse->mainloop = NULL; } - xfree(pulse->device_name); + free(pulse->device_name); freerdp_dsp_context_free(pulse->dsp_context); - xfree(pulse); + free(pulse); } static boolean rdpsnd_pulse_format_supported(rdpsndDevicePlugin* device, rdpsndFormat* format) diff --git a/channels/rdpsnd/client/rdpsnd_main.c b/channels/rdpsnd/client/rdpsnd_main.c index 686acfc0c..3b2c92ec0 100644 --- a/channels/rdpsnd/client/rdpsnd_main.c +++ b/channels/rdpsnd/client/rdpsnd_main.c @@ -104,7 +104,7 @@ static void rdpsnd_process_interval(rdpSvcPlugin* plugin) item = (struct data_out_item*) list_dequeue(rdpsnd->data_out_list); svc_plugin_send(plugin, item->data_out); - xfree(item); + free(item); DEBUG_SVC("processed data_out"); } @@ -135,8 +135,8 @@ static void rdpsnd_free_supported_formats(rdpsndPlugin* rdpsnd) uint16 i; for (i = 0; i < rdpsnd->n_supported_formats; i++) - xfree(rdpsnd->supported_formats[i].data); - xfree(rdpsnd->supported_formats); + free(rdpsnd->supported_formats[i].data); + free(rdpsnd->supported_formats); rdpsnd->supported_formats = NULL; 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); if (format->cbSize > 0) { - format->data = xmalloc(format->cbSize); + format->data = malloc(format->cbSize); memcpy(format->data, data_mark, format->cbSize); } n_out_formats++; @@ -238,7 +238,7 @@ static void rdpsnd_process_message_formats(rdpsndPlugin* rdpsnd, STREAM* data_in } else { - xfree(out_formats); + free(out_formats); DEBUG_WARN("no formats supported"); } @@ -443,7 +443,7 @@ static boolean rdpsnd_load_device_plugin(rdpsndPlugin* rdpsnd, const char* name, strcpy(fullname, "rdpsnd_"); strcat(fullname, name); entry = (PFREERDP_RDPSND_DEVICE_ENTRY)freerdp_load_plugin(fullname, RDPSND_DEVICE_EXPORT_FUNC_NAME); - xfree(fullname); + free(fullname); } if (entry == NULL) { @@ -556,13 +556,13 @@ static void rdpsnd_process_terminate(rdpSvcPlugin* plugin) while ((item = list_dequeue(rdpsnd->data_out_list)) != NULL) { stream_free(item->data_out); - xfree(item); + free(item); } list_free(rdpsnd->data_out_list); rdpsnd_free_supported_formats(rdpsnd); - xfree(plugin); + free(plugin); } /* rdpsnd is always built-in */ diff --git a/channels/rdpsnd/server/rdpsnd.c b/channels/rdpsnd/server/rdpsnd.c index f1578f795..a5d73e7c5 100644 --- a/channels/rdpsnd/server/rdpsnd.c +++ b/channels/rdpsnd/server/rdpsnd.c @@ -133,7 +133,7 @@ static boolean rdpsnd_server_recv_formats(rdpsnd_server* rdpsnd, STREAM* s) { if (stream_get_left(s) < 18) { - xfree(rdpsnd->context.client_formats); + free(rdpsnd->context.client_formats); rdpsnd->context.client_formats = NULL; 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) { - 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; } @@ -479,13 +479,13 @@ void rdpsnd_server_context_free(rdpsnd_server_context* context) stream_free(rdpsnd->rdpsnd_pdu); if (rdpsnd->out_buffer) - xfree(rdpsnd->out_buffer); + free(rdpsnd->out_buffer); if (rdpsnd->dsp_context) freerdp_dsp_context_free(rdpsnd->dsp_context); if (rdpsnd->context.client_formats) - xfree(rdpsnd->context.client_formats); + free(rdpsnd->context.client_formats); - xfree(rdpsnd); + free(rdpsnd); } diff --git a/channels/sample/client/skel_main.c b/channels/sample/client/skel_main.c index 87b846f3a..f9841de05 100644 --- a/channels/sample/client/skel_main.c +++ b/channels/sample/client/skel_main.c @@ -129,7 +129,7 @@ static void skel_process_terminate(rdpSvcPlugin* plugin) /* put your cleanup here */ - xfree(plugin); + free(plugin); } DEFINE_SVC_PLUGIN(skel, "skel", diff --git a/channels/serial/client/serial_main.c b/channels/serial/client/serial_main.c index 5e8e72e2d..fce689b7d 100644 --- a/channels/serial/client/serial_main.c +++ b/channels/serial/client/serial_main.c @@ -110,7 +110,7 @@ static void serial_process_irp_create(SERIAL_DEVICE* serial, IRP* irp) stream_write_uint32(irp->output, FileId); stream_write_uint8(irp->output, 0); - xfree(path); + free(path); irp->Complete(irp); } @@ -162,12 +162,12 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp) } else { - buffer = (uint8*) xmalloc(Length); + buffer = (uint8*) malloc(Length); if (!serial_tty_read(tty, buffer, &Length)) { irp->IoStatus = STATUS_UNSUCCESSFUL; - xfree(buffer); + free(buffer); buffer = NULL; Length = 0; @@ -187,7 +187,7 @@ static void serial_process_irp_read(SERIAL_DEVICE* serial, IRP* irp) stream_write(irp->output, buffer, Length); } - xfree(buffer); + free(buffer); irp->Complete(irp); } @@ -394,7 +394,7 @@ static void serial_free(DEVICE* device) list_free(serial->pending_irps); - xfree(serial); + free(serial); } int DeviceServiceEntry(PDEVICE_SERVICE_ENTRY_POINTS pEntryPoints) diff --git a/channels/serial/client/serial_tty.c b/channels/serial/client/serial_tty.c index 051c5fd1d..0e0f73907 100644 --- a/channels/serial/client/serial_tty.c +++ b/channels/serial/client/serial_tty.c @@ -457,9 +457,9 @@ void serial_tty_free(SERIAL_TTY* tty) close(tty->fd); } - xfree(tty->ptermios); - xfree(tty->pold_termios); - xfree(tty); + free(tty->ptermios); + free(tty->pold_termios); + free(tty); } diff --git a/channels/smartcard/client/scard_main.c b/channels/smartcard/client/scard_main.c index 05cec507f..aee9f6fe8 100644 --- a/channels/smartcard/client/scard_main.c +++ b/channels/smartcard/client/scard_main.c @@ -52,13 +52,13 @@ static void scard_free(DEVICE* dev) /* Begin TS Client defect workaround. */ while ((CompletionIdInfo = (COMPLETIONIDINFO*) list_dequeue(scard->CompletionIds)) != NULL) - xfree(CompletionIdInfo); + free(CompletionIdInfo); list_free(scard->CompletionIds); /* End TS Client defect workaround. */ - xfree(dev); + free(dev); 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); freerdp_thread_free(args->thread); - xfree(args); + free(args); } 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); } list_remove(scard->CompletionIds, CompletionIdInfo); - xfree(CompletionIdInfo); + free(CompletionIdInfo); return duplicate; } } @@ -266,7 +266,7 @@ static void scard_irp_request(DEVICE* device, IRP* irp) * get their own thread * 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(); diff --git a/channels/smartcard/client/scard_operations.c b/channels/smartcard/client/scard_operations.c index 703ddb244..d43a2cafe 100644 --- a/channels/smartcard/client/scard_operations.c +++ b/channels/smartcard/client/scard_operations.c @@ -185,7 +185,7 @@ static uint32 sc_input_string(IRP* irp, char **dest, uint32 dataLength, boolean int bufferSize; 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); @@ -359,7 +359,7 @@ static uint32 handle_ListReaders(IRP* irp, boolean wide) #else rv = SCardListReaders(hContext, NULL, NULL, &dwReaders); - readerList = xmalloc(dwReaders); + readerList = malloc(dwReaders); rv = SCardListReaders(hContext, NULL, readerList, &dwReaders); #endif if (rv != SCARD_S_SUCCESS) @@ -409,7 +409,7 @@ static uint32 handle_ListReaders(IRP* irp, boolean wide) #ifdef SCARD_AUTOALLOCATE SCardFreeMemory(hContext, readerList); #else - xfree(readerList); + free(readerList); #endif return rv; @@ -517,12 +517,12 @@ static uint32 handle_GetStatusChange(IRP* irp, boolean wide) stream_write_zero(irp->output, 4); - xfree((void *)cur->szReader); + free((void *)cur->szReader); } sc_output_alignment(irp, 8); - xfree(readerStates); + free(readerStates); return rv; } @@ -587,7 +587,7 @@ static uint32 handle_Connect(IRP* irp, boolean wide) sc_output_alignment(irp, 8); - xfree(readerName); + free(readerName); return rv; } @@ -729,7 +729,7 @@ static uint32 handle_State(IRP* irp) rv = SCardStatus(hCard, (LPSTR) &readerName, &readerLen, &state, &protocol, pbAtr, &atrLen); #else readerLen = 256; - readerName = xmalloc(readerLen); + readerName = malloc(readerLen); rv = SCardStatus(hCard, (LPSTR) readerName, &readerLen, &state, &protocol, pbAtr, &atrLen); #endif @@ -763,9 +763,9 @@ static uint32 handle_State(IRP* irp) sc_output_alignment(irp, 8); #ifdef SCARD_AUTOALLOCATE - xfree(readerName); + free(readerName); #else - xfree(readerName); + free(readerName); #endif return rv; @@ -802,7 +802,7 @@ static DWORD handle_Status(IRP *irp, boolean wide) rv = SCardStatus(hCard, (LPSTR) &readerName, &readerLen, &state, &protocol, pbAtr, &atrLen); #else readerLen = 256; - readerName = xmalloc(readerLen); + readerName = malloc(readerLen); rv = SCardStatus(hCard, (LPSTR) readerName, &readerLen, &state, &protocol, pbAtr, &atrLen); #endif @@ -856,7 +856,7 @@ static DWORD handle_Status(IRP *irp, boolean wide) /* SCardFreeMemory(NULL, readerName); */ free(readerName); #else - xfree(readerName); + free(readerName); #endif return rv; @@ -909,13 +909,13 @@ static uint32 handle_Transmit(IRP* irp) /* send buffer */ stream_read_uint32(irp->input, linkedLen); - sendBuf = xmalloc(linkedLen); + sendBuf = malloc(linkedLen); stream_read(irp->input, sendBuf, linkedLen); sc_input_repos(irp, linkedLen); } if (cbRecvLength) - recvBuf = xmalloc(cbRecvLength); + recvBuf = malloc(cbRecvLength); if (map[4] & SCARD_INPUT_LINKED) { @@ -968,8 +968,8 @@ static uint32 handle_Transmit(IRP* irp) sc_output_alignment(irp, 8); - xfree(sendBuf); - xfree(recvBuf); + free(sendBuf); + free(recvBuf); return rv; } @@ -1014,7 +1014,7 @@ static uint32 handle_Control(IRP* irp) /* read real input size */ stream_read_uint32(irp->input, recvLength); - recvBuffer = xmalloc(recvLength); + recvBuffer = malloc(recvLength); if (!recvBuffer) return sc_output_return(irp, SCARD_E_NO_MEMORY); @@ -1023,7 +1023,7 @@ static uint32 handle_Control(IRP* irp) } nBytesReturned = outBufferSize; - sendBuffer = xmalloc(outBufferSize); + sendBuffer = malloc(outBufferSize); if (!sendBuffer) return sc_output_return(irp, SCARD_E_NO_MEMORY); @@ -1048,8 +1048,8 @@ static uint32 handle_Control(IRP* irp) sc_output_alignment(irp, 8); - xfree(recvBuffer); - xfree(sendBuffer); + free(recvBuffer); + free(sendBuffer); return rv; } @@ -1165,7 +1165,7 @@ static uint32 handle_GetAttrib(IRP* irp) } sc_output_alignment(irp, 8); - xfree(pbAttr); + free(pbAttr); 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, atrMaskCount); - pAtrMasks = xmalloc(atrMaskCount * sizeof(SERVER_SCARD_ATRMASK)); + pAtrMasks = malloc(atrMaskCount * sizeof(SERVER_SCARD_ATRMASK)); if (!pAtrMasks) 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); - xfree((void*) cur->szReader); + free((void*) cur->szReader); } sc_output_alignment(irp, 8); diff --git a/channels/tsmf/client/alsa/tsmf_alsa.c b/channels/tsmf/client/alsa/tsmf_alsa.c index 52fb9db50..a74e81d16 100644 --- a/channels/tsmf/client/alsa/tsmf_alsa.c +++ b/channels/tsmf/client/alsa/tsmf_alsa.c @@ -209,7 +209,7 @@ static boolean tsmf_alsa_play(ITSMFAudioDevice* audio, uint8* data, uint32 data_ pindex += error * rbytes_per_frame; } } - xfree(data); + free(data); return true; } @@ -245,7 +245,7 @@ static void tsmf_alsa_free(ITSMFAudioDevice* audio) snd_pcm_close(alsa->out_handle); } freerdp_dsp_context_free(alsa->dsp_context); - xfree(alsa); + free(alsa); } ITSMFAudioDevice* TSMFAudioDeviceEntry(void) diff --git a/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c b/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c index 843dba3c2..edd985fe8 100644 --- a/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c +++ b/channels/tsmf/client/ffmpeg/tsmf_ffmpeg.c @@ -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) { 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); 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) { - xfree(mdecoder->decoded_data); + free(mdecoder->decoded_data); mdecoder->decoded_data = NULL; } else if (dst_offset) @@ -425,7 +425,7 @@ static boolean tsmf_ffmpeg_decode(ITSMFDecoder* decoder, const uint8* data, uint if (mdecoder->decoded_data) { - xfree(mdecoder->decoded_data); + free(mdecoder->decoded_data); mdecoder->decoded_data = NULL; } mdecoder->decoded_size = 0; @@ -493,16 +493,16 @@ static void tsmf_ffmpeg_free(ITSMFDecoder* decoder) if (mdecoder->frame) av_free(mdecoder->frame); if (mdecoder->decoded_data) - xfree(mdecoder->decoded_data); + free(mdecoder->decoded_data); if (mdecoder->codec_context) { if (mdecoder->prepared) avcodec_close(mdecoder->codec_context); if (mdecoder->codec_context->extradata) - xfree(mdecoder->codec_context->extradata); + free(mdecoder->codec_context->extradata); av_free(mdecoder->codec_context); } - xfree(decoder); + free(decoder); } static boolean initialized = false; diff --git a/channels/tsmf/client/pulse/tsmf_pulse.c b/channels/tsmf/client/pulse/tsmf_pulse.c index a39e2538d..d1306fcd6 100644 --- a/channels/tsmf/client/pulse/tsmf_pulse.c +++ b/channels/tsmf/client/pulse/tsmf_pulse.c @@ -336,7 +336,7 @@ static boolean tsmf_pulse_play(ITSMFAudioDevice* audio, uint8* data, uint32 data pa_threaded_mainloop_unlock(pulse->mainloop); } - xfree(data); + free(data); return true; } @@ -386,7 +386,7 @@ static void tsmf_pulse_free(ITSMFAudioDevice* audio) pa_threaded_mainloop_free(pulse->mainloop); pulse->mainloop = NULL; } - xfree(pulse); + free(pulse); } ITSMFAudioDevice* TSMFAudioDeviceEntry(void) diff --git a/channels/tsmf/client/tsmf_audio.c b/channels/tsmf/client/tsmf_audio.c index e434fc488..dfe8793f6 100644 --- a/channels/tsmf/client/tsmf_audio.c +++ b/channels/tsmf/client/tsmf_audio.c @@ -44,7 +44,7 @@ static ITSMFAudioDevice* tsmf_load_audio_device_by_name(const char* name, const strcpy(fullname, "tsmf_"); strcat(fullname, name); entry = (TSMF_AUDIO_DEVICE_ENTRY) freerdp_load_plugin(fullname, TSMF_AUDIO_DEVICE_EXPORT_FUNC_NAME); - xfree(fullname); + free(fullname); } if (entry == NULL) { diff --git a/channels/tsmf/client/tsmf_decoder.c b/channels/tsmf/client/tsmf_decoder.c index f884683a3..778420349 100644 --- a/channels/tsmf/client/tsmf_decoder.c +++ b/channels/tsmf/client/tsmf_decoder.c @@ -46,7 +46,7 @@ static ITSMFDecoder* tsmf_load_decoder_by_name(const char* name, TS_AM_MEDIA_TYP strcpy(fullname, "tsmf_"); strcat(fullname, name); entry = (TSMF_DECODER_ENTRY) freerdp_load_plugin(fullname, TSMF_DECODER_EXPORT_FUNC_NAME); - xfree(fullname); + free(fullname); } if (entry == NULL) { diff --git a/channels/tsmf/client/tsmf_main.c b/channels/tsmf/client/tsmf_main.c index 66e1c8082..88390930a 100644 --- a/channels/tsmf/client/tsmf_main.c +++ b/channels/tsmf/client/tsmf_main.c @@ -348,7 +348,7 @@ static int tsmf_on_close(IWTSVirtualChannelCallback* pChannelCallback) tsmf_stream_free(stream); } } - xfree(pChannelCallback); + free(pChannelCallback); return 0; } @@ -396,8 +396,8 @@ static int tsmf_plugin_terminated(IWTSPlugin* pPlugin) DEBUG_DVC(""); if (tsmf->listener_callback) - xfree(tsmf->listener_callback); - xfree(tsmf); + free(tsmf->listener_callback); + free(tsmf); return 0; } diff --git a/channels/tsmf/client/tsmf_media.c b/channels/tsmf/client/tsmf_media.c index 779777ecb..206e39cd4 100644 --- a/channels/tsmf/client/tsmf_media.c +++ b/channels/tsmf/client/tsmf_media.c @@ -216,8 +216,8 @@ static TSMF_SAMPLE* tsmf_stream_pop_sample(TSMF_STREAM* stream, int sync) static void tsmf_sample_free(TSMF_SAMPLE* sample) { if (sample->data) - xfree(sample->data); - xfree(sample); + free(sample->data); + free(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) { - xfree(presentation->last_rects); + free(presentation->last_rects); presentation->last_rects = NULL; } presentation->last_num_rects = presentation->output_num_rects; @@ -477,7 +477,7 @@ static void tsmf_sample_playback(TSMF_SAMPLE* sample) return; } - xfree(sample->data); + free(sample->data); sample->data = NULL; if (stream->major_type == TSMF_MAJOR_TYPE_VIDEO) @@ -564,7 +564,7 @@ static void tsmf_sample_playback(TSMF_SAMPLE* sample) { if (presentation->last_rects) { - xfree(presentation->last_rects); + free(presentation->last_rects); presentation->last_rects = NULL; } 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); if (presentation->last_rects) { - xfree(presentation->last_rects); + free(presentation->last_rects); presentation->last_rects = NULL; } presentation->last_num_rects = 0; if (presentation->output_rects) { - xfree(presentation->output_rects); + free(presentation->output_rects); presentation->output_rects = NULL; } presentation->output_num_rects = 0; @@ -839,7 +839,7 @@ void tsmf_presentation_set_geometry_info(TSMF_PRESENTATION* presentation, presentation->output_width = width; presentation->output_height = height; if (presentation->output_rects) - xfree(presentation->output_rects); + free(presentation->output_rects); presentation->output_rects = rects; presentation->output_num_rects = num_rects; } @@ -907,7 +907,7 @@ void tsmf_presentation_free(TSMF_PRESENTATION* presentation) CloseHandle(presentation->mutex); - xfree(presentation); + free(presentation); } 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); - xfree(stream); + free(stream); stream = 0; } diff --git a/channels/urbdrc/client/urbdrc_main.c b/channels/urbdrc/client/urbdrc_main.c index c9af57f63..3617dcdae 100644 --- a/channels/urbdrc/client/urbdrc_main.c +++ b/channels/urbdrc/client/urbdrc_main.c @@ -1010,7 +1010,7 @@ static int urbdrc_load_udevman_plugin(IWTSPlugin* pPlugin, const char* name, RDP strcpy(fullname, name); strcat(fullname, "_udevman"); entry = (PFREERDP_URBDRC_DEVICE_ENTRY) freerdp_load_plugin(fullname, URBDRC_UDEVMAN_EXPORT_FUNC_NAME); - xfree(fullname); + free(fullname); } if (entry == NULL) diff --git a/client/DirectFB/df_graphics.c b/client/DirectFB/df_graphics.c index 209bf6fa2..d593f4e45 100644 --- a/client/DirectFB/df_graphics.c +++ b/client/DirectFB/df_graphics.c @@ -133,6 +133,6 @@ void df_register_graphics(rdpGraphics* graphics) pointer->SetDefault = df_Pointer_SetDefault; graphics_register_pointer(graphics, pointer); - xfree(pointer); + free(pointer); } diff --git a/client/DirectFB/dfreerdp.c b/client/DirectFB/dfreerdp.c index d787885c9..8f103291d 100644 --- a/client/DirectFB/dfreerdp.c +++ b/client/DirectFB/dfreerdp.c @@ -306,7 +306,7 @@ df_process_channel_event(rdpChannels* channels, freerdp* instance) static void df_free(dfInfo* dfi) { dfi->dfb->Release(dfi->dfb); - xfree(dfi); + free(dfi); } int dfreerdp_run(freerdp* instance) @@ -421,7 +421,7 @@ void* thread_func(void* param) dfreerdp_run(data->instance); - xfree(data); + free(data); pthread_detach(pthread_self()); diff --git a/client/Sample/freerdp.c b/client/Sample/freerdp.c index cdf00cfd1..72804bb2e 100644 --- a/client/Sample/freerdp.c +++ b/client/Sample/freerdp.c @@ -292,7 +292,7 @@ void* thread_func(void* param) tfreerdp_run(data->instance); - xfree(data); + free(data); pthread_detach(pthread_self()); diff --git a/client/Windows/wf_gdi.c b/client/Windows/wf_gdi.c index ea9d6d21f..d2a10c0dc 100644 --- a/client/Windows/wf_gdi.c +++ b/client/Windows/wf_gdi.c @@ -96,7 +96,7 @@ uint8* wf_glyph_convert(wfInfo* wfi, int width, int height, uint8* data) src_bytes_per_row = (width + 7) / 8; 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; for (indexy = 0; indexy < height; indexy++) @@ -376,7 +376,7 @@ void wf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline) 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++) { @@ -388,7 +388,7 @@ void wf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline) } Polyline(wfi->drawing->hdc, pts, polyline->numPoints); - xfree(pts); + free(pts); } 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.height = surface_bits_command->height; 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); 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.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); 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->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); - xfree(wfi->image->_bitmap.data); + free(wfi->image->_bitmap.data); wfi->image->_bitmap.data = temp_image; } else @@ -510,7 +510,7 @@ void wf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits } if (tile_bitmap != NULL) - xfree(tile_bitmap); + free(tile_bitmap); } void wf_gdi_register_update_callbacks(rdpUpdate* update) diff --git a/client/Windows/wf_graphics.c b/client/Windows/wf_graphics.c index e3d8ba852..fc2f669d2 100644 --- a/client/Windows/wf_graphics.c +++ b/client/Windows/wf_graphics.c @@ -71,7 +71,7 @@ wfBitmap* wf_image_new(wfInfo* wfi, int width, int height, int bpp, uint8* data) wfBitmap* image; hdc = GetDC(NULL); - image = (wfBitmap*) xmalloc(sizeof(wfBitmap)); + image = (wfBitmap*) malloc(sizeof(wfBitmap)); image->hdc = CreateCompatibleDC(hdc); 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); if (bitmap->data == NULL) - bitmap->data = (uint8*) xmalloc(size); + bitmap->data = (uint8*) malloc(size); else - bitmap->data = (uint8*) xrealloc(bitmap->data, size); + bitmap->data = (uint8*) realloc(bitmap->data, size); if (compressed) { diff --git a/client/Windows/wfreerdp.c b/client/Windows/wfreerdp.c index 9df8a0bdd..1b8624465 100644 --- a/client/Windows/wfreerdp.c +++ b/client/Windows/wfreerdp.c @@ -303,12 +303,12 @@ boolean wf_post_connect(freerdp* instance) wfi->hdc->alpha = wfi->clrconv->alpha; 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->null = 1; 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->image = wf_image_new(wfi, 64, 64, 32, NULL); diff --git a/client/X11/xf_cliprdr.c b/client/X11/xf_cliprdr.c index 2a2202145..c02f92871 100644 --- a/client/X11/xf_cliprdr.c +++ b/client/X11/xf_cliprdr.c @@ -149,11 +149,11 @@ void xf_cliprdr_uninit(xfInfo* xfi) if (cb) { - xfree(cb->formats); - xfree(cb->data); - xfree(cb->respond); - xfree(cb->incr_data); - xfree(cb); + free(cb->formats); + free(cb->data); + free(cb->respond); + free(cb->incr_data); + free(cb); 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, 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); event->raw_format_data_size = length; 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, 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; 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, 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; for (i = 0; i < length; i++) { @@ -520,7 +520,7 @@ static uint8* xf_cliprdr_process_requested_raw(uint8* data, int* size) { uint8* outbuf; - outbuf = (uint8*) xmalloc(*size); + outbuf = (uint8*) malloc(*size); memcpy(outbuf, data, *size); return outbuf; } @@ -533,7 +533,7 @@ static uint8* xf_cliprdr_process_requested_unicodetext(uint8* data, int* size) inbuf = (char*) lf2crlf(data, size); out_size = freerdp_AsciiToUnicodeAlloc(inbuf, &outbuf, 0); - xfree(inbuf); + free(inbuf); *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); *size = strlen((char*) outbuf) + 1; - xfree(inbuf); + free(inbuf); return outbuf; } @@ -730,7 +730,7 @@ static boolean xf_cliprdr_get_requested_data(xfInfo* xfi, Atom target) cb->incr_starts = true; if (cb->incr_data) { - xfree(cb->incr_data); + free(cb->incr_data); cb->incr_data = NULL; } 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; 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); cb->incr_data_length += bytes_left; XFree(data); @@ -832,12 +832,12 @@ static void xf_cliprdr_process_cb_format_list_event(xfInfo* xfi, RDP_CB_FORMAT_L if (cb->data) { - xfree(cb->data); + free(cb->data); cb->data = NULL; } if (cb->formats) - xfree(cb->formats); + free(cb->formats); cb->formats = event->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) { - cb->data = (uint8*) xmalloc(size); + cb->data = (uint8*) malloc(size); memcpy(cb->data, data, size); cb->data_length = size; crlf2lf(cb->data, &cb->data_length); @@ -943,7 +943,7 @@ static void xf_cliprdr_process_html(clipboardContext* cb, uint8* data, int size) return; } - cb->data = (uint8*) xmalloc(size - start + 1); + cb->data = (uint8*) malloc(size - start + 1); memcpy(cb->data, data + start, end - start); cb->data_length = end - start; 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) { - xfree(cb->data); + free(cb->data); cb->data = NULL; } 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); XFlush(xfi->display); - xfree(cb->respond); + free(cb->respond); cb->respond = NULL; } @@ -1149,7 +1149,7 @@ boolean xf_cliprdr_process_selection_request(xfInfo* xfi, XEvent* xevent) */ if (cb->data) { - xfree(cb->data); + free(cb->data); 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); XFlush(xfi->display); - xfree(respond); + free(respond); } return true; diff --git a/client/X11/xf_gdi.c b/client/X11/xf_gdi.c index e33b35b48..ecc78b363 100644 --- a/client/X11/xf_gdi.c +++ b/client/X11/xf_gdi.c @@ -227,7 +227,7 @@ Pixmap xf_brush_new(xfInfo* xfi, int width, int height, int bpp, uint8* data) XFree(image); if (cdata != data) - xfree(cdata); + free(cdata); XFreeGC(xfi->display, gc); } @@ -568,7 +568,7 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline) XSetForeground(xfi->display, xfi->gc, color); npoints = polyline->numPoints + 1; - points = xmalloc(sizeof(XPoint) * npoints); + points = malloc(sizeof(XPoint) * npoints); points[0].x = polyline->xStart; points[0].y = polyline->yStart; @@ -608,7 +608,7 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline) } XSetFunction(xfi->display, xfi->gc, GXcopy); - xfree(points); + free(points); } 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); npoints = polygon_sc->numPoints + 1; - points = xmalloc(sizeof(XPoint) * npoints); + points = malloc(sizeof(XPoint) * npoints); points[0].x = polygon_sc->xStart; 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); - xfree(points); + free(points); } 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); npoints = polygon_cb->numPoints + 1; - points = xmalloc(sizeof(XPoint) * npoints); + points = malloc(sizeof(XPoint) * npoints); points[0].x = polygon_cb->xStart; 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); - xfree(points); + free(points); } 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); 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); 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 */ 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); freerdp_image_flip(surface_bits_command->bitmapData, xfi->bmp_codec_none, diff --git a/client/X11/xf_graphics.c b/client/X11/xf_graphics.c index 93d0624e2..2ed873aaa 100644 --- a/client/X11/xf_graphics.c +++ b/client/X11/xf_graphics.c @@ -61,12 +61,12 @@ void xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap) XFree(image); if (data != bitmap->data) - xfree(data); + free(data); } else { if (data != bitmap->data) - xfree(bitmap->data); + free(bitmap->data); bitmap->data = data; } @@ -127,9 +127,9 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, size = width * height * (bpp + 7) / 8; if (bitmap->data == NULL) - bitmap->data = (uint8*) xmalloc(size); + bitmap->data = (uint8*) malloc(size); else - bitmap->data = (uint8*) xrealloc(bitmap->data, size); + bitmap->data = (uint8*) realloc(bitmap->data, size); switch (codec_id) { @@ -222,7 +222,7 @@ void xf_Pointer_New(rdpContext* context, rdpPointer* pointer) } ((xfPointer*) pointer)->cursor = XcursorImageLoadCursor(xfi->display, &ci); - xfree(ci.pixels); + free(ci.pixels); } void xf_Pointer_Free(rdpContext* context, rdpPointer* pointer) @@ -376,7 +376,7 @@ void xf_register_graphics(rdpGraphics* graphics) bitmap->SetSurface = xf_Bitmap_SetSurface; graphics_register_bitmap(graphics, bitmap); - xfree(bitmap); + free(bitmap); pointer = xnew(rdpPointer); pointer->size = sizeof(xfPointer); @@ -388,7 +388,7 @@ void xf_register_graphics(rdpGraphics* graphics) pointer->SetDefault = xf_Pointer_SetDefault; graphics_register_pointer(graphics, pointer); - xfree(pointer); + free(pointer); glyph = xnew(rdpGlyph); glyph->size = sizeof(xfGlyph); @@ -400,5 +400,5 @@ void xf_register_graphics(rdpGraphics* graphics) glyph->EndDraw = xf_Glyph_EndDraw; graphics_register_glyph(graphics, glyph); - xfree(glyph); + free(glyph); } diff --git a/client/X11/xf_tsmf.c b/client/X11/xf_tsmf.c index ed4e93c36..8ec037fb7 100644 --- a/client/X11/xf_tsmf.c +++ b/client/X11/xf_tsmf.c @@ -172,10 +172,10 @@ void xf_tsmf_uninit(xfInfo* xfi) } if (xv->xv_pixfmts) { - xfree(xv->xv_pixfmts); + free(xv->xv_pixfmts); xv->xv_pixfmts = NULL; } - xfree(xv); + free(xv); xfi->xv_context = NULL; } } diff --git a/client/X11/xf_window.c b/client/X11/xf_window.c index 38431f6a0..d865fc510 100644 --- a/client/X11/xf_window.c +++ b/client/X11/xf_window.c @@ -173,7 +173,7 @@ boolean xf_GetCurrentDesktop(xfInfo* xfi) } xfi->current_desktop = (int) *prop; - xfree(prop); + free(prop); return true; } @@ -198,7 +198,7 @@ boolean xf_GetWorkArea(xfInfo* xfi) return false; if ((xfi->current_desktop * 4 + 3) >= nitems) { - xfree(prop); + free(prop); return false; } @@ -208,7 +208,7 @@ boolean xf_GetWorkArea(xfInfo* xfi) xfi->workArea.y = plong[xfi->current_desktop * 4 + 1]; xfi->workArea.width = plong[xfi->current_desktop * 4 + 2]; xfi->workArea.height = plong[xfi->current_desktop * 4 + 3]; - xfree(prop); + free(prop); return true; } @@ -511,13 +511,13 @@ xfWindow* xf_CreateWindow(xfInfo* xfi, rdpWindow* wnd, int x, int y, int width, if (class_hints != NULL) { char* class; - class = xmalloc(sizeof(rail_window_class)); + class = malloc(sizeof(rail_window_class)); snprintf(class, sizeof(rail_window_class), "RAIL:%08X", id); class_hints->res_name = "RAIL"; class_hints->res_class = class; XSetClassHint(xfi->display, window->handle, class_hints); XFree(class_hints); - xfree(class); + free(class); } /* 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; propsize = 2 + pixels; - propdata = xmalloc(propsize * sizeof(long)); + propdata = malloc(propsize * sizeof(long)); propdata[0] = icon->entry->width; propdata[1] = icon->entry->height; @@ -790,7 +790,7 @@ void xf_SetWindowRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int n if (nrects == 0) return; - xrects = xmalloc(sizeof(XRectangle) * nrects); + xrects = malloc(sizeof(XRectangle) * nrects); for (i = 0; i < nrects; i++) { @@ -807,7 +807,7 @@ void xf_SetWindowRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* rects, int n */ #endif - xfree(xrects); + free(xrects); } 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) return; - xrects = xmalloc(sizeof(XRectangle) * nrects); + xrects = malloc(sizeof(XRectangle) * nrects); for (i = 0; i < nrects; i++) { @@ -835,7 +835,7 @@ void xf_SetWindowVisibilityRects(xfInfo* xfi, xfWindow* window, RECTANGLE_16* re */ #endif - xfree(xrects); + free(xrects); } 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); } - xfree(window); + free(window); } rdpWindow* xf_rdpWindowFromWindow(xfInfo* xfi, Window wnd) diff --git a/client/X11/xfreerdp.c b/client/X11/xfreerdp.c index 9d6125660..c794704eb 100644 --- a/client/X11/xfreerdp.c +++ b/client/X11/xfreerdp.c @@ -314,17 +314,17 @@ void xf_create_window(xfInfo* xfi) } 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); } 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); } xfi->window = xf_CreateDesktopWindow(xfi, win_title, width, height, xfi->decorations); - xfree(win_title); + free(win_title); if (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, (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) { @@ -805,7 +805,7 @@ boolean xf_post_connect(freerdp* instance) * @param username - unused * @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 - * using xfree(), even in case this function fails. + * using free(), even in case this function fails. * @param domain - unused * @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. // 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) 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++) { 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); @@ -901,9 +901,9 @@ int xf_process_client_args(rdpSettings* settings, const char* opt, const char* v for (i = 0; layouts[i].code; i++) { 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); @@ -911,9 +911,9 @@ int xf_process_client_args(rdpSettings* settings, const char* opt, const char* v for (i = 0; layouts[i].code; i++) { 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); } @@ -1081,11 +1081,11 @@ void xf_free(xfInfo* xfi) { xf_window_free(xfi); - xfree(xfi->bmp_codec_none); + free(xfi->bmp_codec_none); XCloseDisplay(xfi->display); - xfree(xfi); + free(xfi); } /** Main loop for the rdp connection. @@ -1261,7 +1261,7 @@ void* thread_func(void* param) g_disconnect_reason = xfreerdp_run(data->instance); - xfree(data); + free(data); g_thread_count--; diff --git a/cunit/test_cliprdr.c b/cunit/test_cliprdr.c index d92af6706..bcf68a378 100644 --- a/cunit/test_cliprdr.c +++ b/cunit/test_cliprdr.c @@ -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); format_list_event = (RDP_CB_FORMAT_LIST_EVENT*) event; 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[1] = CB_FORMAT_HTML; event_processed = 0; @@ -199,7 +199,7 @@ void test_cliprdr(void) /* 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); 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"); data_response_event->size = 6; event_processed = 0; diff --git a/cunit/test_license.c b/cunit/test_license.c index 390fffeb5..bd18d5c97 100644 --- a/cunit/test_license.c +++ b/cunit/test_license.c @@ -483,7 +483,7 @@ void test_license_decrypt_platform_challenge(void) sizeof(test_licensing_encryption_key)); license->encrypted_platform_challenge->data = - (uint8*) xmalloc(sizeof(test_encrypted_platform_challenge)); + (uint8*) malloc(sizeof(test_encrypted_platform_challenge)); license->encrypted_platform_challenge->length = sizeof(test_encrypted_platform_challenge); diff --git a/cunit/test_rfx.c b/cunit/test_rfx.c index 3b4ad7e27..6720ae922 100644 --- a/cunit/test_rfx.c +++ b/cunit/test_rfx.c @@ -199,7 +199,7 @@ void test_bitstream(void) (void) b; //printf("%u ", b); } - xfree(bs); + free(bs); //printf("\n"); } @@ -221,7 +221,7 @@ void test_bitstream_enc(void) { printf("%X ", buffer[i]); }*/ - xfree(bs); + free(bs); //printf("\n"); } diff --git a/include/freerdp/utils/memory.h b/include/freerdp/utils/memory.h index 18c35b56f..b5ef007c6 100644 --- a/include/freerdp/utils/memory.h +++ b/include/freerdp/utils/memory.h @@ -25,10 +25,8 @@ #include #include -FREERDP_API void* xmalloc(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* xstrtoup(const char* str); FREERDP_API wchar_t* xwcsdup(const wchar_t* wstr); diff --git a/libfreerdp/cache/bitmap.c b/libfreerdp/cache/bitmap.c index 3cebbc07f..2c8a97e6c 100644 --- a/libfreerdp/cache/bitmap.c +++ b/libfreerdp/cache/bitmap.c @@ -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) Bitmap_Free(bitmap_cache->context, bitmap_cache->bitmap); - xfree(bitmap_cache->cells); - xfree(bitmap_cache); + free(bitmap_cache->cells); + free(bitmap_cache); } } diff --git a/libfreerdp/cache/brush.c b/libfreerdp/cache/brush.c index 878a206cd..fef92e56c 100644 --- a/libfreerdp/cache/brush.c +++ b/libfreerdp/cache/brush.c @@ -129,7 +129,7 @@ void brush_cache_put(rdpBrushCache* brush, uint32 index, void* entry, uint32 bpp prevEntry = brush->monoEntries[index].entry; if (prevEntry != NULL) - xfree(prevEntry); + free(prevEntry); brush->monoEntries[index].bpp = bpp; 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; if (prevEntry != NULL) - xfree(prevEntry); + free(prevEntry); brush->entries[index].bpp = bpp; brush->entries[index].entry = entry; @@ -197,10 +197,10 @@ void brush_cache_free(rdpBrushCache* brush) for (i = 0; i < (int) brush->maxEntries; i++) { 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) @@ -208,12 +208,12 @@ void brush_cache_free(rdpBrushCache* brush) for (i = 0; i < (int) brush->maxMonoEntries; i++) { 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); } } diff --git a/libfreerdp/cache/cache.c b/libfreerdp/cache/cache.c index 02d20153d..f2f1a4a70 100644 --- a/libfreerdp/cache/cache.c +++ b/libfreerdp/cache/cache.c @@ -58,6 +58,6 @@ void cache_free(rdpCache* cache) offscreen_cache_free(cache->offscreen); palette_cache_free(cache->palette); nine_grid_cache_free(cache->nine_grid); - xfree(cache); + free(cache); } } diff --git a/libfreerdp/cache/glyph.c b/libfreerdp/cache/glyph.c index 2dff89a47..b074fc4d2 100644 --- a/libfreerdp/cache/glyph.c +++ b/libfreerdp/cache/glyph.c @@ -143,7 +143,7 @@ void update_process_glyph_fragments(rdpContext* context, uint8* data, uint32 len id = data[index + 1]; size = data[index + 2]; - fragments = (uint8*) xmalloc(size); + fragments = (uint8*) malloc(size); memcpy(fragments, data, size); 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_New(context, 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; } @@ -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); 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); 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) { Glyph_Free(glyph_cache->context, prevGlyph); - xfree(prevGlyph->aj); - xfree(prevGlyph); + free(prevGlyph->aj); + free(prevGlyph); } 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) { - xfree(prevFragment); + free(prevFragment); } } @@ -500,20 +500,20 @@ void glyph_cache_free(rdpGlyphCache* glyph_cache) if (glyph != NULL) { Glyph_Free(glyph_cache->context, glyph); - xfree(glyph->aj); - xfree(glyph); + free(glyph->aj); + free(glyph); } } - xfree(glyph_cache->glyphCache[i].entries); + free(glyph_cache->glyphCache[i].entries); } for (i = 0; i < 255; i++) { fragment = glyph_cache->fragCache.entries[i].fragment; - xfree(fragment); + free(fragment); } - xfree(glyph_cache->fragCache.entries); - xfree(glyph_cache); + free(glyph_cache->fragCache.entries); + free(glyph_cache); } } diff --git a/libfreerdp/cache/nine_grid.c b/libfreerdp/cache/nine_grid.c index 9998cfbfe..21c569085 100644 --- a/libfreerdp/cache/nine_grid.c +++ b/libfreerdp/cache/nine_grid.c @@ -87,7 +87,7 @@ void nine_grid_cache_put(rdpNineGridCache* nine_grid, uint32 index, void* entry) prevEntry = nine_grid->entries[index].entry; if (prevEntry != NULL) - xfree(prevEntry); + free(prevEntry); 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++) { 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); } } diff --git a/libfreerdp/cache/offscreen.c b/libfreerdp/cache/offscreen.c index 60a8dda48..5d6168f63 100644 --- a/libfreerdp/cache/offscreen.c +++ b/libfreerdp/cache/offscreen.c @@ -169,7 +169,7 @@ void offscreen_cache_free(rdpOffscreenCache* offscreen_cache) Bitmap_Free(offscreen_cache->update->context, bitmap); } - xfree(offscreen_cache->entries); - xfree(offscreen_cache); + free(offscreen_cache->entries); + free(offscreen_cache); } } diff --git a/libfreerdp/cache/palette.c b/libfreerdp/cache/palette.c index 9ce78a9fe..925ed0245 100644 --- a/libfreerdp/cache/palette.c +++ b/libfreerdp/cache/palette.c @@ -91,8 +91,8 @@ void palette_cache_free(rdpPaletteCache* palette_cache) { if (palette_cache != NULL) { - xfree(palette_cache->entries); - xfree(palette_cache); + free(palette_cache->entries); + free(palette_cache); } } diff --git a/libfreerdp/cache/pointer.c b/libfreerdp/cache/pointer.c index 3ecb205e7..dbc317606 100644 --- a/libfreerdp/cache/pointer.c +++ b/libfreerdp/cache/pointer.c @@ -187,7 +187,7 @@ void pointer_cache_free(rdpPointerCache* pointer_cache) Pointer_Free(pointer_cache->update->context, pointer); } - xfree(pointer_cache->entries); - xfree(pointer_cache); + free(pointer_cache->entries); + free(pointer_cache); } } diff --git a/libfreerdp/channels/libchannels.c b/libfreerdp/channels/libchannels.c index c8d0bb82f..9c5fcede1 100644 --- a/libfreerdp/channels/libchannels.c +++ b/libfreerdp/channels/libchannels.c @@ -663,12 +663,12 @@ void freerdp_channels_free(rdpChannels* channels) prev->next = list->next; else g_channels_list = list->next; - xfree(list); + free(list); } ReleaseMutex(g_mutex_list); - xfree(channels); + free(channels); } int freerdp_channels_client_load(rdpChannels* channels, rdpSettings* settings, void* entry, void* data) diff --git a/libfreerdp/channels/wtsvc.c b/libfreerdp/channels/wtsvc.c index 9bbbca256..9db452a09 100644 --- a/libfreerdp/channels/wtsvc.c +++ b/libfreerdp/channels/wtsvc.c @@ -47,8 +47,8 @@ typedef struct wts_data_item static void wts_data_item_free(wts_data_item* item) { - xfree(item->buffer); - xfree(item); + free(item->buffer); + free(item); } 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->length = length; - item->buffer = xmalloc(length); + item->buffer = malloc(length); memcpy(item->buffer, buffer, length); WaitForSingleObject(channel->mutex, INFINITE); @@ -429,7 +429,7 @@ void WTSDestroyVirtualChannelManager(WTSVirtualChannelManager* vcm) list_free(vcm->send_queue); CloseHandle(vcm->mutex); - xfree(vcm); + free(vcm); } } @@ -585,7 +585,7 @@ boolean WTSVirtualChannelQuery( { case WTSVirtualFileHandle: wait_obj_get_fds(channel->receive_event, fds, &fds_count); - *ppBuffer = xmalloc(sizeof(void*)); + *ppBuffer = malloc(sizeof(void*)); memcpy(*ppBuffer, &fds[0], sizeof(void*)); *pBytesReturned = sizeof(void*); result = true; @@ -615,7 +615,7 @@ boolean WTSVirtualChannelQuery( break; } } - *ppBuffer = xmalloc(sizeof(boolean)); + *ppBuffer = malloc(sizeof(boolean)); memcpy(*ppBuffer, &bval, sizeof(boolean)); *pBytesReturned = sizeof(boolean); break; @@ -629,7 +629,7 @@ boolean WTSVirtualChannelQuery( void WTSFreeMemory( /* __in */ void* pMemory) { - xfree(pMemory); + free(pMemory); } boolean WTSVirtualChannelRead( @@ -691,7 +691,7 @@ boolean WTSVirtualChannelWrite( if (channel->channel_type == RDP_PEER_CHANNEL_TYPE_SVC) { item = xnew(wts_data_item); - item->buffer = xmalloc(Length); + item->buffer = malloc(Length); item->length = Length; memcpy(item->buffer, Buffer, Length); @@ -710,7 +710,7 @@ boolean WTSVirtualChannelWrite( while (Length > 0) { 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_seek_uint8(s); @@ -800,7 +800,7 @@ boolean WTSVirtualChannelClose( if (channel->mutex) CloseHandle(channel->mutex); - xfree(channel); + free(channel); } return true; diff --git a/libfreerdp/codec/bitmap.c b/libfreerdp/codec/bitmap.c index d87fa5f81..008aa7f0d 100644 --- a/libfreerdp/codec/bitmap.c +++ b/libfreerdp/codec/bitmap.c @@ -445,10 +445,10 @@ boolean bitmap_decompress(uint8* srcData, uint8* dstData, int width, int height, 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); freerdp_bitmap_flip(TmpBfr, dstData, width * 2, height); - xfree(TmpBfr); + free(TmpBfr); } 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) { - TmpBfr = (uint8*) xmalloc(width * height * 2); + TmpBfr = (uint8*) malloc(width * height * 2); RleDecompress16to16(srcData, size, TmpBfr, width * 2, width, height); freerdp_bitmap_flip(TmpBfr, dstData, width * 2, height); - xfree(TmpBfr); + free(TmpBfr); } else if (srcBpp == 8 && dstBpp == 8) { - TmpBfr = (uint8*) xmalloc(width * height); + TmpBfr = (uint8*) malloc(width * height); RleDecompress8to8(srcData, size, TmpBfr, width, width, height); freerdp_bitmap_flip(TmpBfr, dstData, width, height); - xfree(TmpBfr); + free(TmpBfr); } 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); freerdp_bitmap_flip(TmpBfr, dstData, width * 3, height); - xfree(TmpBfr); + free(TmpBfr); } else { diff --git a/libfreerdp/codec/color.c b/libfreerdp/codec/color.c index ddc0f0a24..3ae5fb661 100644 --- a/libfreerdp/codec/color.c +++ b/libfreerdp/codec/color.c @@ -369,7 +369,7 @@ uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int if (dstBpp == 8) { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height); + dstData = (uint8*) malloc(width * height); memcpy(dstData, srcData, width * height); 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)) { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 2); + dstData = (uint8*) malloc(width * height * 2); dst16 = (uint16 *) dstData; 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) { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 2); + dstData = (uint8*) malloc(width * height * 2); dst16 = (uint16 *) dstData; 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) { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 4); + dstData = (uint8*) malloc(width * height * 4); src8 = (uint8*) srcData; 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 (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 2); + dstData = (uint8*) malloc(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) { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 4); + dstData = (uint8*) malloc(width * height * 4); src16 = (uint16 *) srcData; dst32 = (uint32 *) dstData; @@ -477,7 +477,7 @@ uint8* freerdp_image_convert_15bpp(uint8* srcData, uint8* dstData, int width, in else if (dstBpp == 16) { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 2); + dstData = (uint8*) malloc(width * height * 2); src16 = (uint16 *) srcData; dst16 = (uint16 *) dstData; @@ -505,7 +505,7 @@ uint8* freerdp_image_convert_16bpp(uint8* srcData, uint8* dstData, int width, in if (dstBpp == 16) { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 2); + dstData = (uint8*) malloc(width * height * 2); if (clrconv->rgb555) { @@ -538,7 +538,7 @@ uint8* freerdp_image_convert_16bpp(uint8* srcData, uint8* dstData, int width, in uint8 red, green, blue; if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 3); + dstData = (uint8*) malloc(width * height * 3); dst8 = (uint8*) dstData; src16 = (uint16*) srcData; @@ -572,7 +572,7 @@ uint8* freerdp_image_convert_16bpp(uint8* srcData, uint8* dstData, int width, in uint8 red, green, blue; if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 4); + dstData = (uint8*) malloc(width * height * 4); src16 = (uint16*) srcData; dst32 = (uint32*) dstData; @@ -600,7 +600,7 @@ uint8* freerdp_image_convert_24bpp(uint8* srcData, uint8* dstData, int width, in { uint8 *dstp; if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 4); + dstData = (uint8*) malloc(width * height * 4); dstp = dstData; 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; if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 2); + dstData = (uint8*) malloc(width * height * 2); dst16 = (uint16*) dstData; src32 = (uint32*) srcData; @@ -647,7 +647,7 @@ uint8* freerdp_image_convert_32bpp(uint8* srcData, uint8* dstData, int width, in uint8 red, green, blue; if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 3); + dstData = (uint8*) malloc(width * height * 3); dstp = dstData; 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; if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 4); + dstData = (uint8*) malloc(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 { if (dstData == NULL) - dstData = (uint8*) xmalloc(width * height * 4); + dstData = (uint8*) malloc(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) { /* 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 * fixed size buffers (of max scanline size (or adaptative?) ) * -- would be much faster). */ - uint8 * tmpBfr = xmalloc(scanLineSz); + uint8 * tmpBfr = malloc(scanLineSz); int half = height / 2; /* Flip buffer in place by line permutations through the temp * scan line buffer. @@ -765,7 +765,7 @@ void freerdp_bitmap_flip(uint8 * src, uint8 * dst, int scanLineSz, int height) bottomLine -= scanLineSz; height--; } - xfree(tmpBfr); + free(tmpBfr); } /* Flip from source buffer to destination buffer. */ else @@ -788,7 +788,7 @@ uint8* freerdp_image_flip(uint8* srcData, uint8* dstData, int width, int height, scanline = width * ((bpp + 7) / 8); 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); return dstData; @@ -862,7 +862,7 @@ uint8* freerdp_glyph_convert(int width, int height, uint8* data) */ scanline = (width + 7) / 8; - dstData = (uint8*) xmalloc(width * height); + dstData = (uint8*) malloc(width * height); memset(dstData, 0, width * height); 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; 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) { - dstData = (uint8*) xmalloc(width * height * 4); + dstData = (uint8*) malloc(width * height * 4); dst32 = (uint32*) dstData; for (index = height; index > 0; index--) @@ -1070,8 +1070,8 @@ void freerdp_clrconv_free(HCLRCONV clrconv) if (clrconv != NULL) { if (clrconv->palette != NULL) - xfree(clrconv->palette); + free(clrconv->palette); - xfree(clrconv); + free(clrconv); } } diff --git a/libfreerdp/codec/mppc_dec.c b/libfreerdp/codec/mppc_dec.c index 22cc1b5ad..4ed6e1357 100644 --- a/libfreerdp/codec/mppc_dec.c +++ b/libfreerdp/codec/mppc_dec.c @@ -1414,7 +1414,7 @@ struct rdp_mppc_dec* mppc_dec_new(void) { 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) { printf("mppc_new(): system out of memory\n"); @@ -1426,7 +1426,7 @@ struct rdp_mppc_dec* mppc_dec_new(void) if (!ptr->history_buf) { printf("mppc_new(): system out of memory\n"); - xfree(ptr); + free(ptr); return NULL; } @@ -1450,14 +1450,14 @@ void mppc_dec_free(struct rdp_mppc_dec* dec) if (dec->history_buf) { - xfree(dec->history_buf); + free(dec->history_buf); dec->history_buf = NULL; dec->history_ptr = NULL; } if (dec->offset_cache) { - xfree(dec->offset_cache); + free(dec->offset_cache); dec->offset_cache = NULL; } - xfree(dec); + free(dec); } diff --git a/libfreerdp/codec/mppc_enc.c b/libfreerdp/codec/mppc_enc.c index a01669d6b..167a6faeb 100644 --- a/libfreerdp/codec/mppc_enc.c +++ b/libfreerdp/codec/mppc_enc.c @@ -444,30 +444,30 @@ struct rdp_mppc_enc* mppc_enc_new(int protocol_type) enc->buf_len = RDP_50_HIST_BUF_LEN; break; default: - xfree(enc); + free(enc); return NULL; } enc->first_pkt = 1; enc->historyBuffer = (char*) xzalloc(enc->buf_len); if (enc->historyBuffer == NULL) { - xfree(enc); + free(enc); return NULL; } enc->outputBufferPlus = (char*) xzalloc(enc->buf_len + 64); if (enc->outputBufferPlus == NULL) { - xfree(enc->historyBuffer); - xfree(enc); + free(enc->historyBuffer); + free(enc); return NULL; } enc->outputBuffer = enc->outputBufferPlus + 64; enc->hash_table = (uint16*) xzalloc(enc->buf_len * 2); if (enc->hash_table == NULL) { - xfree(enc->historyBuffer); - xfree(enc->outputBufferPlus); - xfree(enc); + free(enc->historyBuffer); + free(enc->outputBufferPlus); + free(enc); return NULL; } return enc; @@ -483,10 +483,10 @@ void mppc_enc_free(struct rdp_mppc_enc* enc) { if (enc == NULL) return; - xfree(enc->historyBuffer); - xfree(enc->outputBufferPlus); - xfree(enc->hash_table); - xfree(enc); + free(enc->historyBuffer); + free(enc->outputBufferPlus); + free(enc->hash_table); + free(enc); } /** diff --git a/libfreerdp/codec/nsc.c b/libfreerdp/codec/nsc.c index e0bfb9a82..05cad27b2 100644 --- a/libfreerdp/codec/nsc.c +++ b/libfreerdp/codec/nsc.c @@ -199,7 +199,7 @@ static void nsc_context_initialize(NSC_CONTEXT* context, STREAM* s) } else if (length > context->bmpdata_length) { - context->bmpdata = xrealloc(context->bmpdata, length + 16); + context->bmpdata = realloc(context->bmpdata, length + 16); 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) { 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; } @@ -244,10 +244,10 @@ void nsc_context_free(NSC_CONTEXT* context) for (i = 0; i < 4; i++) { if (context->priv->plane_buf[i]) - xfree(context->priv->plane_buf[i]); + free(context->priv->plane_buf[i]); } if (context->bmpdata) - xfree(context->bmpdata); + free(context->bmpdata); nsc_profiler_print(context); 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_encode); - xfree(context->priv); - xfree(context); + free(context->priv); + free(context); } NSC_CONTEXT* nsc_context_new(void) diff --git a/libfreerdp/codec/nsc_encode.c b/libfreerdp/codec/nsc_encode.c index dde2f6a09..d8e7ce674 100644 --- a/libfreerdp/codec/nsc_encode.c +++ b/libfreerdp/codec/nsc_encode.c @@ -48,7 +48,7 @@ static void nsc_context_initialize_encode(NSC_CONTEXT* context) if (length > context->priv->plane_buf_length) { 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; } diff --git a/libfreerdp/codec/rfx.c b/libfreerdp/codec/rfx.c index 7deaaf271..6da02c202 100644 --- a/libfreerdp/codec/rfx.c +++ b/libfreerdp/codec/rfx.c @@ -177,15 +177,15 @@ void rfx_context_set_cpu_opt(RFX_CONTEXT* context, uint32 cpu_opt) void rfx_context_free(RFX_CONTEXT* context) { - xfree(context->quants); + free(context->quants); rfx_pool_free(context->priv->pool); rfx_profiler_print(context); rfx_profiler_free(context); - xfree(context->priv); - xfree(context); + free(context->priv); + free(context); } 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) - 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 - message->rects = (RFX_RECT*) xmalloc(message->num_rects * sizeof(RFX_RECT)); + message->rects = (RFX_RECT*) malloc(message->num_rects * sizeof(RFX_RECT)); /* rects */ 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) */ 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 - context->quants = (uint32*) xmalloc(context->num_quants * 10 * sizeof(uint32)); + context->quants = (uint32*) malloc(context->num_quants * 10 * sizeof(uint32)); quants = context->quants; /* quantVals */ @@ -617,15 +617,15 @@ void rfx_message_free(RFX_CONTEXT* context, RFX_MESSAGE* message) { if (message != NULL) { - xfree(message->rects); + free(message->rects); if (message->tiles != NULL) { rfx_pool_put_tiles(context->priv->pool, message->tiles, message->num_tiles); - xfree(message->tiles); + free(message->tiles); } - xfree(message); + free(message); } } diff --git a/libfreerdp/codec/rfx_pool.c b/libfreerdp/codec/rfx_pool.c index e97b752ec..eb4e5a214 100644 --- a/libfreerdp/codec/rfx_pool.c +++ b/libfreerdp/codec/rfx_pool.c @@ -53,14 +53,14 @@ void rfx_pool_free(RFX_POOL* pool) if (tile != NULL) { if (tile->data != NULL) - xfree(tile->data); + free(tile->data); - xfree(tile); + free(tile); } } - xfree(pool->tiles); - xfree(pool); + free(pool->tiles); + free(pool); } 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) { 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; @@ -81,7 +81,7 @@ RFX_TILE* rfx_pool_get_tile(RFX_POOL* pool) if (pool->count < 1) { tile = xnew(RFX_TILE); - tile->data = (uint8*) xmalloc(4096 * 4); /* 64x64 * 4 */ + tile->data = (uint8*) malloc(4096 * 4); /* 64x64 * 4 */ } else { @@ -106,7 +106,7 @@ RFX_TILE** rfx_pool_get_tiles(RFX_POOL* pool, int count) int i; 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++) { diff --git a/libfreerdp/codec/rfx_rlgr.c b/libfreerdp/codec/rfx_rlgr.c index c7730c4bc..9a7b1ba37 100644 --- a/libfreerdp/codec/rfx_rlgr.c +++ b/libfreerdp/codec/rfx_rlgr.c @@ -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); } @@ -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); - xfree(bs); + free(bs); return processed_size; } diff --git a/libfreerdp/core/certificate.c b/libfreerdp/core/certificate.c index 5e815367b..76ed0558a 100644 --- a/libfreerdp/core/certificate.c +++ b/libfreerdp/core/certificate.c @@ -218,7 +218,7 @@ rdpX509CertChain* certificate_new_x509_certificate_chain(uint32 count) { 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->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++) { 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); - xfree(x509_cert_chain); + free(x509_cert_chain->array); + 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); - 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); certificate->x509_cert_chain->array[i].length = certLength; @@ -489,7 +489,7 @@ boolean certificate_read_server_certificate(rdpCertificate* certificate, uint8* break; } - xfree(s); + free(s); return true; } @@ -509,7 +509,7 @@ rdpKey* key_new(const char* keyfile) if (fp == NULL) { printf("unable to load RSA key from %s: %s.", keyfile, strerror(errno)); - xfree(key) ; + free(key) ; return NULL; } @@ -519,7 +519,7 @@ rdpKey* key_new(const char* keyfile) { ERR_print_errors_fp(stdout); fclose(fp); - xfree(key) ; + free(key) ; return NULL; } @@ -530,7 +530,7 @@ rdpKey* key_new(const char* keyfile) case 0: RSA_free(rsa); printf("invalid RSA key in %s", keyfile); - xfree(key) ; + free(key) ; return NULL; case 1: @@ -540,7 +540,7 @@ rdpKey* key_new(const char* keyfile) default: ERR_print_errors_fp(stdout); RSA_free(rsa); - xfree(key) ; + free(key) ; return NULL; } @@ -548,7 +548,7 @@ rdpKey* key_new(const char* keyfile) { RSA_free(rsa); printf("RSA public exponent too large in %s", keyfile); - xfree(key) ; + free(key) ; return NULL; } @@ -577,7 +577,7 @@ void key_free(rdpKey* key) { free(key->Modulus); free(key->PrivateExponent); - xfree(key); + free(key); } } @@ -615,6 +615,6 @@ void certificate_free(rdpCertificate* certificate) if (certificate->cert_info.Modulus != NULL) free(certificate->cert_info.Modulus); - xfree(certificate); + free(certificate); } } diff --git a/libfreerdp/core/connection.c b/libfreerdp/core/connection.c index ea126ab9e..1a11b4d00 100644 --- a/libfreerdp/core/connection.c +++ b/libfreerdp/core/connection.c @@ -146,7 +146,7 @@ boolean rdp_client_redirect(rdpRdp* rdp) free(settings->server_random); free(settings->server_certificate); - xfree(settings->ip_address); + free(settings->ip_address); rdp->transport = transport_new(settings); rdp->license = license_new(rdp); @@ -164,30 +164,30 @@ boolean rdp_client_redirect(rdpRdp* rdp) { if (redirection->flags & LB_TARGET_NET_ADDRESS) { - xfree(settings->hostname); + free(settings->hostname); settings->hostname = xstrdup(redirection->targetNetAddress.ascii); } else if (redirection->flags & LB_TARGET_FQDN) { - xfree(settings->hostname); + free(settings->hostname); settings->hostname = xstrdup(redirection->targetFQDN.ascii); } else if (redirection->flags & LB_TARGET_NETBIOS_NAME) { - xfree(settings->hostname); + free(settings->hostname); settings->hostname = xstrdup(redirection->targetNetBiosName.ascii); } } if (redirection->flags & LB_USERNAME) { - xfree(settings->username); + free(settings->username); settings->username = xstrdup(redirection->username.ascii); } if (redirection->flags & LB_DOMAIN) { - xfree(settings->domain); + free(settings->domain); settings->domain = xstrdup(redirection->domain.ascii); } diff --git a/libfreerdp/core/extension.c b/libfreerdp/core/extension.c index b0a6c48e8..2ddae36a4 100644 --- a/libfreerdp/core/extension.c +++ b/libfreerdp/core/extension.c @@ -224,6 +224,6 @@ void extension_free(rdpExtension* extension) if (extension != NULL) { extension_uninit_plugins(extension); - xfree(extension); + free(extension); } } diff --git a/libfreerdp/core/fastpath.c b/libfreerdp/core/fastpath.c index 7c9f63535..1994b8531 100644 --- a/libfreerdp/core/fastpath.c +++ b/libfreerdp/core/fastpath.c @@ -333,7 +333,7 @@ static boolean fastpath_recv_update_data(rdpFastPath* fastpath, STREAM* s) stream_set_pos(s, next_pos); if (comp_stream != s) - xfree(comp_stream); + free(comp_stream); return true; } @@ -774,5 +774,5 @@ rdpFastPath* fastpath_new(rdpRdp* rdp) void fastpath_free(rdpFastPath* fastpath) { stream_free(fastpath->updateData); - xfree(fastpath); + free(fastpath); } diff --git a/libfreerdp/core/freerdp.c b/libfreerdp/core/freerdp.c index 2055d274f..5f44c7808 100644 --- a/libfreerdp/core/freerdp.c +++ b/libfreerdp/core/freerdp.c @@ -132,7 +132,7 @@ boolean freerdp_connect(freerdp* instance) { 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; s->size = record.length; @@ -144,7 +144,7 @@ boolean freerdp_connect(freerdp* instance) update->EndPaint(update->context); } - xfree(s->data); + free(s->data); return true; } } @@ -269,7 +269,7 @@ void freerdp_context_free(freerdp* instance) rdp_free(instance->context->rdp); graphics_free(instance->context->graphics); - xfree(instance->context); + free(instance->context); instance->context = NULL; } @@ -304,6 +304,6 @@ void freerdp_free(freerdp* instance) { if (instance) { - xfree(instance); + free(instance); } } diff --git a/libfreerdp/core/gcc.c b/libfreerdp/core/gcc.c index 4b70d317c..0cfb63252 100644 --- a/libfreerdp/core/gcc.c +++ b/libfreerdp/core/gcc.c @@ -495,7 +495,7 @@ boolean gcc_read_client_core_data(STREAM* s, rdpSettings* settings, uint16 block stream_seek(s, 32); snprintf(settings->client_hostname, 31, "%s", str); settings->client_hostname[31] = 0; - xfree(str); + free(str); stream_read_uint32(s, settings->kbd_type); /* keyboardType */ 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); stream_seek(s, 64); snprintf(settings->client_product_id, 32, "%s", str); - xfree(str); + free(str); blockLength -= 64; 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_zero(s, 32 - ((clientNameLength + 1) * 2)); - xfree(clientName); + free(clientName); stream_write_uint32(s, settings->kbd_type); /* keyboardType */ 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_zero(s, 64 - clientDigProductIdLength - 2); - xfree(clientDigProductId); + free(clientDigProductId); stream_write_uint8(s, connectionType); /* connectionType */ stream_write_uint8(s, 0); /* pad1octet */ diff --git a/libfreerdp/core/graphics.c b/libfreerdp/core/graphics.c index 324484777..cc574ce9a 100644 --- a/libfreerdp/core/graphics.c +++ b/libfreerdp/core/graphics.c @@ -33,7 +33,7 @@ rdpBitmap* Bitmap_Alloc(rdpContext* context) rdpGraphics* graphics; graphics = context->graphics; - bitmap = (rdpBitmap*) xmalloc(graphics->Bitmap_Prototype->size); + bitmap = (rdpBitmap*) malloc(graphics->Bitmap_Prototype->size); if (bitmap != NULL) { @@ -56,9 +56,9 @@ void Bitmap_Free(rdpContext* context, rdpBitmap* bitmap) bitmap->Free(context, bitmap); 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; graphics = context->graphics; - pointer = (rdpPointer*) xmalloc(graphics->Pointer_Prototype->size); + pointer = (rdpPointer*) malloc(graphics->Pointer_Prototype->size); if (pointer != NULL) { @@ -117,12 +117,12 @@ void Pointer_Free(rdpContext* context, rdpPointer* pointer) pointer->Free(context, pointer); if (pointer->xorMaskData) - xfree(pointer->xorMaskData); + free(pointer->xorMaskData); if (pointer->andMaskData) - xfree(pointer->andMaskData); + free(pointer->andMaskData); - xfree(pointer); + free(pointer); } } @@ -155,7 +155,7 @@ rdpGlyph* Glyph_Alloc(rdpContext* context) rdpGraphics* graphics; graphics = context->graphics; - glyph = (rdpGlyph*) xmalloc(graphics->Glyph_Prototype->size); + glyph = (rdpGlyph*) malloc(graphics->Glyph_Prototype->size); if (glyph != NULL) { @@ -230,9 +230,9 @@ void graphics_free(rdpGraphics* graphics) { if (graphics != NULL) { - xfree(graphics->Bitmap_Prototype); - xfree(graphics->Pointer_Prototype); - xfree(graphics->Glyph_Prototype); - xfree(graphics); + free(graphics->Bitmap_Prototype); + free(graphics->Pointer_Prototype); + free(graphics->Glyph_Prototype); + free(graphics); } } diff --git a/libfreerdp/core/http.c b/libfreerdp/core/http.c index b9c7ceda4..2b5a2840d 100644 --- a/libfreerdp/core/http.c +++ b/libfreerdp/core/http.c @@ -42,7 +42,7 @@ HttpContext* http_context_new() void http_context_set_method(HttpContext* http_context, char* method) { if (http_context->Method) - xfree(http_context->Method); + free(http_context->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) { if (http_context->URI) - xfree(http_context->URI); + free(http_context->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) { if (http_context->UserAgent) - xfree(http_context->UserAgent); + free(http_context->UserAgent); 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) { if (http_context->Host) - xfree(http_context->Host); + free(http_context->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) { if (http_context->Accept) - xfree(http_context->Accept); + free(http_context->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) { if (http_context->CacheControl) - xfree(http_context->CacheControl); + free(http_context->CacheControl); 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) { if (http_context->Connection) - xfree(http_context->Connection); + free(http_context->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) { if (http_context->Pragma) - xfree(http_context->Pragma); + free(http_context->Pragma); http_context->Pragma = xstrdup(pragma); } @@ -107,20 +107,20 @@ void http_context_free(HttpContext* http_context) { if (http_context != NULL) { - xfree(http_context->UserAgent); - xfree(http_context->Host); - xfree(http_context->Accept); - xfree(http_context->CacheControl); - xfree(http_context->Connection); - xfree(http_context->Pragma); - xfree(http_context); + free(http_context->UserAgent); + free(http_context->Host); + free(http_context->Accept); + free(http_context->CacheControl); + free(http_context->Connection); + free(http_context->Pragma); + free(http_context); } } void http_request_set_method(HttpRequest* http_request, char* method) { if (http_request->Method) - xfree(http_request->Method); + free(http_request->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) { if (http_request->URI) - xfree(http_request->URI); + free(http_request->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) { if (http_request->AuthScheme) - xfree(http_request->AuthScheme); + free(http_request->AuthScheme); 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) { if (http_request->AuthParam) - xfree(http_request->AuthParam); + free(http_request->AuthParam); 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, "\n", 1); - xfree(http_request->lines[i]); + free(http_request->lines[i]); } stream_write(s, "\n", 1); - xfree(http_request->lines); + free(http_request->lines); stream_write(s, "\0", 1); /* append null terminator */ 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) { - xfree(http_request->Method); - xfree(http_request->URI); - xfree(http_request); + free(http_request->Method); + free(http_request->URI); + free(http_request); } } @@ -420,7 +420,7 @@ HttpResponse* http_response_recv(rdpTls* tls) nbytes = 0; length = 10000; - buffer = xmalloc(length); + buffer = malloc(length); http_response = http_response_new(); p = buffer; @@ -466,7 +466,7 @@ HttpResponse* http_response_recv(rdpTls* tls) } 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; line = strtok((char*) buffer, "\r\n"); @@ -491,12 +491,12 @@ HttpResponse* http_response_recv(rdpTls* tls) if ((length - nbytes) <= 0) { length *= 2; - buffer = xrealloc(buffer, length); + buffer = realloc(buffer, length); p = (uint8*) &buffer[nbytes]; } } - xfree(buffer); + free(buffer); return http_response; } @@ -520,19 +520,19 @@ void http_response_free(HttpResponse* http_response) if (http_response != NULL) { 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); - xfree(http_response->AuthScheme); - xfree(http_response->Authorization); + free(http_response->AuthParam); + free(http_response->AuthScheme); + free(http_response->Authorization); if (http_response->ContentLength > 0) - xfree(http_response->Content); + free(http_response->Content); - xfree(http_response); + free(http_response); } } diff --git a/libfreerdp/core/info.c b/libfreerdp/core/info.c index cb0ba8267..432a77ca4 100644 --- a/libfreerdp/core/info.c +++ b/libfreerdp/core/info.c @@ -132,7 +132,7 @@ boolean rdp_read_extended_info_packet(STREAM* s, rdpSettings* settings) return false; if (settings->client_dir) - xfree(settings->client_dir); + free(settings->client_dir); freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &settings->client_dir, cbClientDir / 2); stream_seek(s, cbClientDir); @@ -205,8 +205,8 @@ void rdp_write_extended_info_packet(STREAM* s, rdpSettings* settings) /* reserved1 (2 bytes) */ /* reserved2 (2 bytes) */ - xfree(clientAddress); - xfree(clientDir); + free(clientAddress); + free(clientDir); } /** @@ -399,13 +399,13 @@ void rdp_write_info_packet(STREAM* s, rdpSettings* settings) stream_write(s, workingDir, cbWorkingDir); stream_write_uint16(s, 0); - xfree(domain); - xfree(userName); - xfree(alternateShell); - xfree(workingDir); + free(domain); + free(userName); + free(alternateShell); + free(workingDir); if (!usedPasswordCookie) - xfree(password); + free(password); if (settings->rdp_version >= 5) rdp_write_extended_info_packet(s, settings); /* extraInfo */ diff --git a/libfreerdp/core/input.c b/libfreerdp/core/input.c index 0c69ae54d..3aaa975ab 100644 --- a/libfreerdp/core/input.c +++ b/libfreerdp/core/input.c @@ -437,6 +437,6 @@ void input_free(rdpInput* input) { if (input != NULL) { - xfree(input); + free(input); } } diff --git a/libfreerdp/core/license.c b/libfreerdp/core/license.c index d22284d09..0980d619a 100644 --- a/libfreerdp/core/license.c +++ b/libfreerdp/core/license.c @@ -331,7 +331,7 @@ void license_encrypt_premaster_secret(rdpLicense* license) freerdp_hexdump(exponent, 4); #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); 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->data = encrypted_premaster_secret; #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); license->encrypted_premaster_secret->type = BB_RANDOM_BLOB; @@ -355,7 +355,7 @@ void license_decrypt_platform_challenge(rdpLicense* license) CryptoRc4 rc4; license->platform_challenge->data = - (uint8*) xmalloc(license->encrypted_platform_challenge->length); + (uint8*) malloc(license->encrypted_platform_challenge->length); license->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) */ - productInfo->pbCompanyName = (uint8*) xmalloc(productInfo->cbCompanyName); + productInfo->pbCompanyName = (uint8*) malloc(productInfo->cbCompanyName); stream_read(s, productInfo->pbCompanyName, productInfo->cbCompanyName); 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); } @@ -409,7 +409,7 @@ PRODUCT_INFO* license_new_product_info() { PRODUCT_INFO* productInfo; - productInfo = (PRODUCT_INFO*) xmalloc(sizeof(PRODUCT_INFO)); + productInfo = (PRODUCT_INFO*) malloc(sizeof(PRODUCT_INFO)); productInfo->dwVersion = 0; productInfo->cbCompanyName = 0; @@ -429,12 +429,12 @@ PRODUCT_INFO* license_new_product_info() void license_free_product_info(PRODUCT_INFO* productInfo) { if (productInfo->pbCompanyName != NULL) - xfree(productInfo->pbCompanyName); + free(productInfo->pbCompanyName); 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->data = (uint8*) xmalloc(blob->length); + blob->data = (uint8*) malloc(blob->length); stream_read(s, blob->data, blob->length); /* blobData */ } @@ -509,7 +509,7 @@ LICENSE_BLOB* license_new_binary_blob(uint16 type) { LICENSE_BLOB* blob; - blob = (LICENSE_BLOB*) xmalloc(sizeof(LICENSE_BLOB)); + blob = (LICENSE_BLOB*) malloc(sizeof(LICENSE_BLOB)); blob->type = type; blob->length = 0; blob->data = NULL; @@ -526,9 +526,9 @@ LICENSE_BLOB* license_new_binary_blob(uint16 type) void license_free_binary_blob(LICENSE_BLOB* blob) { 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) */ scopeList->count = scopeCount; - scopeList->array = (LICENSE_BLOB*) xmalloc(sizeof(LICENSE_BLOB) * scopeCount); + scopeList->array = (LICENSE_BLOB*) malloc(sizeof(LICENSE_BLOB) * scopeCount); /* ScopeArray */ for (i = 0; i < scopeCount; i++) @@ -566,7 +566,7 @@ SCOPE_LIST* license_new_scope_list() { SCOPE_LIST* scopeList; - scopeList = (SCOPE_LIST*) xmalloc(sizeof(SCOPE_LIST)); + scopeList = (SCOPE_LIST*) malloc(sizeof(SCOPE_LIST)); scopeList->count = 0; 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, - * 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. * 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++) { - xfree(scopeList->array[i].data); + free(scopeList->array[i].data); } - xfree(scopeList->array) ; - xfree(scopeList); + free(scopeList->array) ; + free(scopeList); } /** @@ -836,13 +836,13 @@ void license_send_platform_challenge_response_packet(rdpLicense* license) license->encrypted_platform_challenge->type = BB_DATA_BLOB; 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->length], license->hwid, HWID_LENGTH); 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); crypto_rc4(rc4, HWID_LENGTH, license->hwid, buffer); 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_hwid); license_free_scope_list(license->scope_list); - xfree(license); + free(license); } } diff --git a/libfreerdp/core/listener.c b/libfreerdp/core/listener.c index b78e0bca9..63ed52c84 100644 --- a/libfreerdp/core/listener.c +++ b/libfreerdp/core/listener.c @@ -332,8 +332,8 @@ void freerdp_listener_free(freerdp_listener* instance) rdpListener* listener; listener = (rdpListener*) instance->listener; - xfree(listener); + free(listener); - xfree(instance); + free(instance); } diff --git a/libfreerdp/core/mcs.c b/libfreerdp/core/mcs.c index b55bcb6e8..0320964c2 100644 --- a/libfreerdp/core/mcs.c +++ b/libfreerdp/core/mcs.c @@ -836,6 +836,6 @@ void mcs_free(rdpMcs* mcs) { if (mcs != NULL) { - xfree(mcs); + free(mcs); } } diff --git a/libfreerdp/core/nego.c b/libfreerdp/core/nego.c index 9b7cd70ca..f9d0338fb 100644 --- a/libfreerdp/core/nego.c +++ b/libfreerdp/core/nego.c @@ -266,7 +266,7 @@ boolean nego_send_preconnection_pdu(rdpNego* nego) if (wszPCB) { stream_write(s, wszPCB, cchPCB * 2); /* wszPCB */ - xfree(wszPCB); + free(wszPCB); } if (transport_write(nego->transport, s) < 0) @@ -831,7 +831,7 @@ rdpNego* nego_new(struct rdp_transport * transport) void nego_free(rdpNego* nego) { - xfree(nego); + free(nego); } /** diff --git a/libfreerdp/core/orders.c b/libfreerdp/core/orders.c index 5d1af4567..552722372 100644 --- a/libfreerdp/core/orders.c +++ b/libfreerdp/core/orders.c @@ -779,9 +779,9 @@ void update_read_polyline_order(STREAM* s, ORDER_INFO* orderInfo, POLYLINE_ORDER stream_read_uint8(s, polyline->cbData); 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 - 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); } @@ -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)) { /* 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]; update_read_2byte_signed(s, &glyph->x); 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); glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy; 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); 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); 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 - 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); } @@ -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); 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 - 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); } @@ -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) */ if (bitmapData->data == NULL) - bitmapData->data = (uint8*) xmalloc(bitmapData->length); + bitmapData->data = (uint8*) malloc(bitmapData->length); else - bitmapData->data = (uint8*) xrealloc(bitmapData->data, bitmapData->length); + bitmapData->data = (uint8*) realloc(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; if (colorTable == NULL) - colorTable = (uint32*) xmalloc(cache_color_table_order->numberColors * 4); + colorTable = (uint32*) malloc(cache_color_table_order->numberColors * 4); 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++) { @@ -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) { - 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]; @@ -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->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); } @@ -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) { - 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]; @@ -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->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); } @@ -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; - cache_brush_order->data = (uint8*) xmalloc(size); + cache_brush_order->data = (uint8*) malloc(size); 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) { 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++) diff --git a/libfreerdp/core/peer.c b/libfreerdp/core/peer.c index c1c0f86e2..d9cbcf532 100644 --- a/libfreerdp/core/peer.c +++ b/libfreerdp/core/peer.c @@ -415,7 +415,7 @@ void freerdp_peer_free(freerdp_peer* client) if (client) { rdp_free(client->context->rdp); - xfree(client->context); - xfree(client); + free(client->context); + free(client); } } diff --git a/libfreerdp/core/rdp.c b/libfreerdp/core/rdp.c index 5f5d65b26..b5aa423e5 100644 --- a/libfreerdp/core/rdp.c +++ b/libfreerdp/core/rdp.c @@ -966,7 +966,7 @@ void rdp_free(rdpRdp* rdp) redirection_free(rdp->redirection); mppc_dec_free(rdp->mppc_dec); mppc_enc_free(rdp->mppc_enc); - xfree(rdp); + free(rdp); } } diff --git a/libfreerdp/core/redirection.c b/libfreerdp/core/redirection.c index 6c8673ac6..6895ccd9a 100644 --- a/libfreerdp/core/redirection.c +++ b/libfreerdp/core/redirection.c @@ -216,10 +216,10 @@ void redirection_free(rdpRedirection* redirection) for (i = 0; i < (int) redirection->targetNetAddressesCount; i++) freerdp_string_free(&redirection->targetNetAddresses[i]); - xfree(redirection->targetNetAddresses); + free(redirection->targetNetAddresses); } - xfree(redirection); + free(redirection); } } diff --git a/libfreerdp/core/rpc.c b/libfreerdp/core/rpc.c index 9124c9952..319a7b1e5 100644 --- a/libfreerdp/core/rpc.c +++ b/libfreerdp/core/rpc.c @@ -104,7 +104,7 @@ boolean ntlm_authenticate(rdpNtlm* ntlm) ntlm->outputBufferDesc.pBuffers = &ntlm->outputBuffer; ntlm->outputBuffer.BufferType = SECBUFFER_TOKEN; ntlm->outputBuffer.cbBuffer = ntlm->cbMaxToken; - ntlm->outputBuffer.pvBuffer = xmalloc(ntlm->outputBuffer.cbBuffer); + ntlm->outputBuffer.pvBuffer = malloc(ntlm->outputBuffer.cbBuffer); 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); http_request_free(http_request); - xfree(base64_ntlm_token); + free(base64_ntlm_token); 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.reserved = 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].n_transfer_syn = 1; 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[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].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_mid = 0x1ceb; 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[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].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_mid = 0x9812; 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_reserved = 0x00; /* :01 reserved, m.b.z. */ 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); stream_free(ntlm_stream); @@ -479,7 +479,7 @@ boolean rpc_send_bind_pdu(rdpRpc* rpc) rpc_in_write(rpc, pdu->data, pdu->size); stream_free(pdu) ; - xfree(bind_pdu); + free(bind_pdu); return true; } @@ -494,7 +494,7 @@ int rpc_recv_bind_ack_pdu(rdpRpc* rpc) RPC_PDU_HEADER header; int pdu_length = 0x8FFF; - pdu = xmalloc(pdu_length); + pdu = malloc(pdu_length); if (pdu == NULL) return -1; @@ -509,11 +509,11 @@ int rpc_recv_bind_ack_pdu(rdpRpc* rpc) stream_detach(s); stream_free(s); - auth_data = xmalloc(header.auth_length); + auth_data = malloc(header.auth_length); if (auth_data == NULL) { - xfree(pdu); + free(pdu); return -1; } @@ -526,7 +526,7 @@ int rpc_recv_bind_ack_pdu(rdpRpc* rpc) ntlm_authenticate(rpc->ntlm); } - xfree(pdu); + free(pdu); 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_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_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); 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)); stream_free(pdu) ; - xfree(rpc_auth_3_pdu); + free(rpc_auth_3_pdu); 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 */ rts_send_flow_control_ack_pdu(rpc); /* Send FlowControlAck every time AvailableWindow reaches the half */ - pdu = xmalloc(0xFFFF); + pdu = malloc(0xFFFF); if (pdu == NULL) { @@ -608,7 +608,7 @@ int rpc_out_read(rdpRpc* rpc, uint8* data, int length) if (status <= 0) { - xfree(pdu); + free(pdu); return status; } @@ -625,14 +625,14 @@ int rpc_out_read(rdpRpc* rpc, uint8* data, int length) if (status < 0) { - xfree(pdu); + free(pdu); return status; } if (header.ptype == PTYPE_RTS) /* RTS PDU */ { printf("rpc_out_read error: Unexpected RTS PDU\n"); - xfree(pdu); + free(pdu); return -1; } else @@ -645,7 +645,7 @@ int rpc_out_read(rdpRpc* rpc, uint8* data, int length) if (length < header.frag_length) { printf("rpc_out_read error! receive buffer is not large enough\n"); - xfree(pdu); + free(pdu); return -1; } @@ -657,7 +657,7 @@ int rpc_out_read(rdpRpc* rpc, uint8* data, int length) printf("\n"); #endif - xfree(pdu); + free(pdu); 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_level = 0x05; /* :01 which level within service */ 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++) { @@ -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_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); @@ -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); - xfree(request_pdu->auth_verifier.auth_value); - xfree(request_pdu->auth_verifier.auth_pad); - xfree(request_pdu); + free(request_pdu->auth_verifier.auth_value); + free(request_pdu->auth_verifier.auth_pad); + free(request_pdu); 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; uint32 call_id = -1; int rpc_length = length + 0xFF; - uint8* rpc_data = xmalloc(rpc_length); + uint8* rpc_data = malloc(rpc_length); if (rpc_data == NULL) { @@ -796,13 +796,13 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length) if (rpc->read_buffer_len > (uint32) length) { printf("rpc_read error: receiving buffer is not large enough\n"); - xfree(rpc_data); + free(rpc_data); return -1; } memcpy(data, rpc->read_buffer, rpc->read_buffer_len); read += rpc->read_buffer_len; - xfree(rpc->read_buffer); + free(rpc->read_buffer); rpc->read_buffer_len = 0; } @@ -812,7 +812,7 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length) if (status == 0) { - xfree(rpc_data); + free(rpc_data); return read; } else if (status < 0) @@ -821,7 +821,7 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length) rpc->VirtualConnection->DefaultInChannel->BytesSent, rpc->VirtualConnection->DefaultOutChannel->BytesReceived); - xfree(rpc_data); + free(rpc_data); 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 */ { 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; @@ -857,7 +857,7 @@ int rpc_read(rdpRpc* rpc, uint8* data, int length) break; } - xfree(rpc_data); + free(rpc_data); return read; } @@ -924,7 +924,7 @@ void rpc_client_virtual_connection_free(RpcVirtualConnection* virtual_connection { 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_out); rpc_client_virtual_connection_free(rpc->VirtualConnection); - xfree(rpc); + free(rpc); } } diff --git a/libfreerdp/core/rts.c b/libfreerdp/core/rts.c index f14fd66f3..687ca5bf1 100644 --- a/libfreerdp/core/rts.c +++ b/libfreerdp/core/rts.c @@ -688,7 +688,7 @@ int rts_recv_pdu(rdpRpc* rpc, RTS_PDU* rts_pdu) stream_free(s); 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); diff --git a/libfreerdp/core/settings.c b/libfreerdp/core/settings.c index 45d0be19a..8b16c7c61 100644 --- a/libfreerdp/core/settings.c +++ b/libfreerdp/core/settings.c @@ -293,34 +293,34 @@ void settings_free(rdpSettings* settings) { if (settings != NULL) { - xfree(settings->hostname); - xfree(settings->username); - xfree(settings->password); - xfree(settings->domain); - xfree(settings->shell); - xfree(settings->directory); - xfree(settings->ip_address); - xfree(settings->client_dir); - xfree(settings->cert_file); - xfree(settings->privatekey_file); - xfree(settings->received_caps); - xfree(settings->order_support); - xfree(settings->client_hostname); - xfree(settings->client_product_id); - xfree(settings->server_random); - xfree(settings->server_certificate); - xfree(settings->rdp_key_file); + free(settings->hostname); + free(settings->username); + free(settings->password); + free(settings->domain); + free(settings->shell); + free(settings->directory); + free(settings->ip_address); + free(settings->client_dir); + free(settings->cert_file); + free(settings->privatekey_file); + free(settings->received_caps); + free(settings->order_support); + free(settings->client_hostname); + free(settings->client_product_id); + free(settings->server_random); + free(settings->server_certificate); + free(settings->rdp_key_file); certificate_free(settings->server_cert); - xfree(settings->client_auto_reconnect_cookie); - xfree(settings->server_auto_reconnect_cookie); - xfree(settings->client_time_zone); - xfree(settings->bitmapCacheV2CellInfo); - xfree(settings->glyphCache); - xfree(settings->fragCache); + free(settings->client_auto_reconnect_cookie); + free(settings->server_auto_reconnect_cookie); + free(settings->client_time_zone); + free(settings->bitmapCacheV2CellInfo); + free(settings->glyphCache); + free(settings->fragCache); key_free(settings->server_key); - xfree(settings->config_path); - xfree(settings->current_path); - xfree(settings->development_path); - xfree(settings); + free(settings->config_path); + free(settings->current_path); + free(settings->development_path); + free(settings); } } diff --git a/libfreerdp/core/tcp.c b/libfreerdp/core/tcp.c index 9bd850584..b409e1fbd 100644 --- a/libfreerdp/core/tcp.c +++ b/libfreerdp/core/tcp.c @@ -257,6 +257,6 @@ void tcp_free(rdpTcp* tcp) { if (tcp != NULL) { - xfree(tcp); + free(tcp); } } diff --git a/libfreerdp/core/timezone.c b/libfreerdp/core/timezone.c index 0862d40e1..135c095b5 100644 --- a/libfreerdp/core/timezone.c +++ b/libfreerdp/core/timezone.c @@ -90,7 +90,7 @@ boolean rdp_read_client_time_zone(STREAM* s, rdpSettings* settings) freerdp_UnicodeToAsciiAlloc((WCHAR*) stream_get_tail(s), &str, 64 / 2); stream_seek(s, 64); strncpy(clientTimeZone->standardName, str, sizeof(clientTimeZone->standardName)); - xfree(str); + free(str); rdp_read_system_time(s, &clientTimeZone->standardDate); /* StandardDate */ 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); stream_seek(s, 64); strncpy(clientTimeZone->daylightName, str, sizeof(clientTimeZone->daylightName)); - xfree(str); + free(str); rdp_read_system_time(s, &clientTimeZone->daylightDate); /* DaylightDate */ 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 */ DEBUG_TIMEZONE("DaylightBias=%d", bias2c); - xfree(standardName); - xfree(daylightName); + free(standardName); + free(daylightName); } diff --git a/libfreerdp/core/transport.c b/libfreerdp/core/transport.c index 231041f5f..02d5ff4e1 100644 --- a/libfreerdp/core/transport.c +++ b/libfreerdp/core/transport.c @@ -541,6 +541,6 @@ void transport_free(rdpTransport* transport) tcp_free(transport->tcp_in); tsg_free(transport->tsg); - xfree(transport); + free(transport); } } diff --git a/libfreerdp/core/tsg.c b/libfreerdp/core/tsg.c index 560f2c6c4..c19acde87 100644 --- a/libfreerdp/core/tsg.c +++ b/libfreerdp/core/tsg.c @@ -492,7 +492,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) } length = 0x8FFF; - data = xmalloc(length); + data = malloc(length); if (data == NULL) { printf("rpc_recv - memory allocation error\n") ; @@ -503,7 +503,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) if (status <= 0) { printf("rpc_recv failed!\n"); - xfree(data) ; + free(data) ; return false; } @@ -534,7 +534,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) if (status <= 0) { printf("rpc_write opnum=2 failed!\n"); - xfree(data) ; + free(data) ; return false; } @@ -543,7 +543,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) if (status <= 0) { printf("rpc_recv failed!\n"); - xfree(data) ; + free(data) ; return false; } @@ -566,7 +566,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) if (status <= 0) { printf("rpc_write opnum=3 failed!\n"); - xfree(data) ; + free(data) ; return false; } 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_uint16(s_p4, 0x0000); /* unicode zero to terminate hostname string */ - xfree(dest_addr_unic); + free(dest_addr_unic); /** * OpNum = 4 @@ -604,7 +604,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) { printf("rpc_write opnum=4 failed!\n"); stream_free(s_p4); - xfree(data); + free(data); return false; } @@ -614,7 +614,7 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) { printf("rpc_recv failed!\n"); stream_free(s_p4); - xfree(data); + free(data); return false; } @@ -643,12 +643,12 @@ boolean tsg_connect(rdpTsg* tsg, const char* hostname, uint16 port) { printf("rpc_write opnum=8 failed!\n"); stream_free(s_p4); - xfree(data); + free(data); return false; } stream_free(s_p4); - xfree(data); + free(data); return true; } @@ -688,6 +688,6 @@ void tsg_free(rdpTsg* tsg) if (tsg != NULL) { rpc_free(tsg->rpc); - xfree(tsg); + free(tsg); } } diff --git a/libfreerdp/core/update.c b/libfreerdp/core/update.c index 985b9d4d1..c8af9e302 100644 --- a/libfreerdp/core/update.c +++ b/libfreerdp/core/update.c @@ -101,7 +101,7 @@ void update_read_bitmap(rdpUpdate* update, STREAM* s, BITMAP_UPDATE* bitmap_upda 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); 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) { - 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); } 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); } @@ -635,7 +635,7 @@ rdpUpdate* update_new(rdpRdp* rdp) deleteList = &(update->altsec->create_offscreen_bitmap.deleteList); deleteList->sIndices = 64; - deleteList->indices = xmalloc(deleteList->sIndices * 2); + deleteList->indices = malloc(deleteList->sIndices * 2); deleteList->cIndices = 0; update->SuppressOutput = update_send_suppress_output; @@ -650,17 +650,17 @@ void update_free(rdpUpdate* update) { OFFSCREEN_DELETE_LIST* deleteList; deleteList = &(update->altsec->create_offscreen_bitmap.deleteList); - xfree(deleteList->indices); + free(deleteList->indices); - xfree(update->bitmap_update.rectangles); - xfree(update->pointer); - xfree(update->primary->polyline.points); - xfree(update->primary->polygon_sc.points); - xfree(update->primary); - xfree(update->secondary); - xfree(update->altsec); - xfree(update->window); - xfree(update); + free(update->bitmap_update.rectangles); + free(update->pointer); + free(update->primary->polyline.points); + free(update->primary->polygon_sc.points); + free(update->primary); + free(update->secondary); + free(update->altsec); + free(update->window); + free(update); } } diff --git a/libfreerdp/core/window.c b/libfreerdp/core/window.c index 996eeadfd..20dad3902 100644 --- a/libfreerdp/core/window.c +++ b/libfreerdp/core/window.c @@ -46,23 +46,23 @@ void update_read_icon_info(STREAM* s, ICON_INFO* icon_info) /* bitsMask */ if (icon_info->bitsMask == NULL) - icon_info->bitsMask = (uint8*) xmalloc(icon_info->cbBitsMask); + icon_info->bitsMask = (uint8*) malloc(icon_info->cbBitsMask); 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); /* colorTable */ if (icon_info->colorTable == NULL) - icon_info->colorTable = (uint8*) xmalloc(icon_info->cbColorTable); + icon_info->colorTable = (uint8*) malloc(icon_info->cbColorTable); 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); /* bitsColor */ if (icon_info->bitsColor == NULL) - icon_info->bitsColor = (uint8*) xmalloc(icon_info->cbBitsColor); + icon_info->bitsColor = (uint8*) malloc(icon_info->cbBitsColor); 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); } @@ -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) */ size = sizeof(RECTANGLE_16) * window_state->numWindowRects; - window_state->windowRects = (RECTANGLE_16*) xmalloc(size); + window_state->windowRects = (RECTANGLE_16*) malloc(size); /* windowRects */ 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) */ size = sizeof(RECTANGLE_16) * window_state->numVisibilityRects; - window_state->visibilityRects = (RECTANGLE_16*) xmalloc(size); + window_state->visibilityRects = (RECTANGLE_16*) malloc(size); /* visibilityRects */ 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; if (monitored_desktop->windowIds == NULL) - monitored_desktop->windowIds = (uint32*) xmalloc(size); + monitored_desktop->windowIds = (uint32*) malloc(size); else - monitored_desktop->windowIds = (uint32*) xrealloc(monitored_desktop->windowIds, size); + monitored_desktop->windowIds = (uint32*) realloc(monitored_desktop->windowIds, size); /* windowIds */ for (i = 0; i < (int) monitored_desktop->numWindowIds; i++) diff --git a/libfreerdp/crypto/certificate.c b/libfreerdp/crypto/certificate.c index 61e0ab0f3..f60d6f0f7 100644 --- a/libfreerdp/crypto/certificate.c +++ b/libfreerdp/crypto/certificate.c @@ -93,11 +93,11 @@ int certificate_data_match(rdpCertificateStore* certificate_store, rdpCertificat if (size < 1) return match; - data = (char*) xmalloc(size + 2); + data = (char*) malloc(size + 2); if (fread(data, size, 1, fp) != 1) { - xfree(data); + free(data); return match; } @@ -128,7 +128,7 @@ int certificate_data_match(rdpCertificateStore* certificate_store, rdpCertificat pline = strtok(NULL, "\n"); } - xfree(data); + free(data); return match; } @@ -154,11 +154,11 @@ void certificate_data_replace(rdpCertificateStore* certificate_store, rdpCertifi if (size < 1) return; - data = (char*) xmalloc(size + 2); + data = (char*) malloc(size + 2); if (fread(data, size, 1, fp) != 1) { - xfree(data); + free(data); return; } @@ -192,7 +192,7 @@ void certificate_data_replace(rdpCertificateStore* certificate_store, rdpCertifi } fclose(fp); - xfree(data); + free(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) { - xfree(certificate_data->hostname); - xfree(certificate_data->fingerprint); - xfree(certificate_data); + free(certificate_data->hostname); + free(certificate_data->fingerprint); + free(certificate_data); } } @@ -256,8 +256,8 @@ void certificate_store_free(rdpCertificateStore* certstore) if (certstore->fp != NULL) fclose(certstore->fp); - xfree(certstore->path); - xfree(certstore->file); - xfree(certstore); + free(certstore->path); + free(certstore->file); + free(certstore); } } diff --git a/libfreerdp/crypto/crypto.c b/libfreerdp/crypto/crypto.c index a520e52e4..6caf93aa0 100644 --- a/libfreerdp/crypto/crypto.c +++ b/libfreerdp/crypto/crypto.c @@ -25,7 +25,7 @@ CryptoSha1 crypto_sha1_init(void) { - CryptoSha1 sha1 = xmalloc(sizeof(*sha1)); + CryptoSha1 sha1 = malloc(sizeof(*sha1)); SHA1_Init(&sha1->sha_ctx); 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) { SHA1_Final(out_data, &sha1->sha_ctx); - xfree(sha1); + free(sha1); } CryptoMd5 crypto_md5_init(void) { - CryptoMd5 md5 = xmalloc(sizeof(*md5)); + CryptoMd5 md5 = malloc(sizeof(*md5)); MD5_Init(&md5->md5_ctx); 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) { MD5_Final(out_data, &md5->md5_ctx); - xfree(md5); + free(md5); } 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); 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) { if (rc4) - xfree(rc4); + free(rc4); } 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_EncryptInit_ex(&des3->des3_ctx, EVP_des_ede3_cbc(), NULL, key, ivec); 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 des3 = xmalloc(sizeof(*des3)); + CryptoDes3 des3 = malloc(sizeof(*des3)); EVP_CIPHER_CTX_init(&des3->des3_ctx); EVP_DecryptInit_ex(&des3->des3_ctx, EVP_des_ede3_cbc(), NULL, key, ivec); EVP_CIPHER_CTX_set_padding(&des3->des3_ctx, 0); @@ -115,12 +115,12 @@ void crypto_des3_free(CryptoDes3 des3) if (des3 == NULL) return; EVP_CIPHER_CTX_cleanup(&des3->des3_ctx); - xfree(des3); + free(des3); } CryptoHmac crypto_hmac_new(void) { - CryptoHmac hmac = xmalloc(sizeof(*hmac)); + CryptoHmac hmac = malloc(sizeof(*hmac)); HMAC_CTX_init(&hmac->hmac_ctx); return hmac; } @@ -145,12 +145,12 @@ void crypto_hmac_free(CryptoHmac hmac) if (hmac == NULL) return; HMAC_CTX_cleanup(&hmac->hmac_ctx); - xfree(hmac); + free(hmac); } 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 */ cert->px509 = d2i_X509(NULL, (D2I_X509_CONST uint8 **) &data, length); return cert; @@ -163,7 +163,7 @@ void crypto_cert_free(CryptoCert cert) X509_free(cert->px509); - xfree(cert); + free(cert); } 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; 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; 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(&mod); 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) @@ -407,8 +407,8 @@ char** crypto_cert_subject_alt_name(X509* xcert, int* count, int** lengths) return NULL; num_subject_alt_names = sk_GENERAL_NAME_num(subject_alt_names); - strings = (char**) xmalloc(sizeof(char*) * num_subject_alt_names); - *lengths = (int*) xmalloc(sizeof(int*) * num_subject_alt_names); + strings = (char**) malloc(sizeof(char*) * num_subject_alt_names); + *lengths = (int*) malloc(sizeof(int*) * num_subject_alt_names); 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) { - xfree(strings) ; - xfree(*lengths) ; + free(strings) ; + free(*lengths) ; *lengths = NULL ; return NULL; } @@ -497,7 +497,7 @@ rdpCertificateData* crypto_get_certificate_data(X509* xcert, char* hostname) fp = crypto_cert_fingerprint(xcert); certdata = certificate_data_new(hostname, fp); - xfree(fp); + free(fp); 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. " "Please look at the documentation on how to create local certificate store for a private CA.\n"); - xfree(subject); - xfree(issuer); - xfree(fp); + free(subject); + free(issuer); + free(fp); } 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); - base64_string = xmalloc(bptr->length); + base64_string = malloc(bptr->length); memcpy(base64_string, bptr->data, bptr->length - 1); 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; - *dec_data = xmalloc(length); + *dec_data = malloc(length); memset(*dec_data, 0, length); b64 = BIO_new(BIO_f_base64()); diff --git a/libfreerdp/crypto/tls.c b/libfreerdp/crypto/tls.c index 8c8fd6f10..2462b6a7c 100644 --- a/libfreerdp/crypto/tls.c +++ b/libfreerdp/crypto/tls.c @@ -43,7 +43,7 @@ static CryptoCert tls_get_certificate(rdpTls* tls, boolean peer) } else { - cert = xmalloc(sizeof(*cert)); + cert = malloc(sizeof(*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) { X509_free(cert->px509); - xfree(cert); + free(cert); } boolean tls_connect(rdpTls* tls) @@ -241,7 +241,7 @@ boolean tls_accept(rdpTls* tls, const char* cert_file, const char* privatekey_fi return false; } - xfree(cert); + free(cert); 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) { - xfree(common_name); + free(common_name); common_name = NULL; } @@ -550,16 +550,16 @@ boolean tls_verify_certificate(rdpTls* tls, CryptoCert cert, char* hostname) verification_status = true; /* success! */ } - xfree(issuer); - xfree(subject); - xfree(fingerprint); + free(issuer); + free(subject); + free(fingerprint); } if (certificate_data) { - xfree(certificate_data->fingerprint); - xfree(certificate_data->hostname); - xfree(certificate_data); + free(certificate_data->fingerprint); + free(certificate_data->hostname); + free(certificate_data); } return verification_status; @@ -644,6 +644,6 @@ void tls_free(rdpTls* tls) certificate_store_free(tls->certificate_store); - xfree(tls); + free(tls); } } diff --git a/libfreerdp/gdi/bitmap.c b/libfreerdp/gdi/bitmap.c index e2828caaa..4ca68ed2c 100644 --- a/libfreerdp/gdi/bitmap.c +++ b/libfreerdp/gdi/bitmap.c @@ -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 hBitmap = (HGDI_BITMAP) xmalloc(sizeof(GDI_BITMAP)); + HGDI_BITMAP hBitmap = (HGDI_BITMAP) malloc(sizeof(GDI_BITMAP)); hBitmap->objectType = GDIOBJECT_BITMAP; hBitmap->bitsPerPixel = cBitsPerPixel; 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 hBitmap = (HGDI_BITMAP) xmalloc(sizeof(GDI_BITMAP)); + HGDI_BITMAP hBitmap = (HGDI_BITMAP) malloc(sizeof(GDI_BITMAP)); hBitmap->objectType = GDIOBJECT_BITMAP; hBitmap->bytesPerPixel = hdc->bytesPerPixel; hBitmap->bitsPerPixel = hdc->bitsPerPixel; hBitmap->width = nWidth; hBitmap->height = nHeight; - hBitmap->data = xmalloc(nWidth * nHeight * hBitmap->bytesPerPixel); + hBitmap->data = malloc(nWidth * nHeight * hBitmap->bytesPerPixel); hBitmap->scanline = nWidth * hBitmap->bytesPerPixel; return hBitmap; } diff --git a/libfreerdp/gdi/brush.c b/libfreerdp/gdi/brush.c index a93312c81..c92099306 100644 --- a/libfreerdp/gdi/brush.c +++ b/libfreerdp/gdi/brush.c @@ -55,7 +55,7 @@ p_PatBlt PatBlt_[5] = HGDI_BRUSH gdi_CreateSolidBrush(GDI_COLOR crColor) { - HGDI_BRUSH hBrush = (HGDI_BRUSH) xmalloc(sizeof(GDI_BRUSH)); + HGDI_BRUSH hBrush = (HGDI_BRUSH) malloc(sizeof(GDI_BRUSH)); hBrush->objectType = GDIOBJECT_BRUSH; hBrush->style = GDI_BS_SOLID; hBrush->color = crColor; @@ -71,7 +71,7 @@ HGDI_BRUSH gdi_CreateSolidBrush(GDI_COLOR crColor) HGDI_BRUSH gdi_CreatePatternBrush(HGDI_BITMAP hbmp) { - HGDI_BRUSH hBrush = (HGDI_BRUSH) xmalloc(sizeof(GDI_BRUSH)); + HGDI_BRUSH hBrush = (HGDI_BRUSH) malloc(sizeof(GDI_BRUSH)); hBrush->objectType = GDIOBJECT_BRUSH; hBrush->style = GDI_BS_PATTERN; hBrush->pattern = hbmp; diff --git a/libfreerdp/gdi/dc.c b/libfreerdp/gdi/dc.c index f08330820..4c814ebfc 100644 --- a/libfreerdp/gdi/dc.c +++ b/libfreerdp/gdi/dc.c @@ -44,7 +44,7 @@ HGDI_DC gdi_GetDC() { - HGDI_DC hDC = (HGDI_DC) xmalloc(sizeof(GDI_DC)); + HGDI_DC hDC = (HGDI_DC) malloc(sizeof(GDI_DC)); hDC->bytesPerPixel = 4; hDC->bitsPerPixel = 32; hDC->drawMode = GDI_R2_BLACK; @@ -62,7 +62,7 @@ HGDI_DC gdi_GetDC() HGDI_DC gdi_CreateDC(HCLRCONV clrconv, int bpp) { - HGDI_DC hDC = (HGDI_DC) xmalloc(sizeof(GDI_DC)); + HGDI_DC hDC = (HGDI_DC) malloc(sizeof(GDI_DC)); hDC->drawMode = GDI_R2_BLACK; hDC->clip = gdi_CreateRectRgn(0, 0, 0, 0); @@ -76,12 +76,12 @@ HGDI_DC gdi_CreateDC(HCLRCONV clrconv, int bpp) hDC->invert = clrconv->invert; hDC->rgb555 = clrconv->rgb555; - hDC->hwnd = (HGDI_WND) xmalloc(sizeof(GDI_WND)); + hDC->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND)); hDC->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0); hDC->hwnd->invalid->null = 1; hDC->hwnd->count = 32; - hDC->hwnd->cinvalid = (HGDI_RGN) xmalloc(sizeof(GDI_RGN) * hDC->hwnd->count); + hDC->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * hDC->hwnd->count); hDC->hwnd->ninvalid = 0; return hDC; @@ -96,7 +96,7 @@ HGDI_DC gdi_CreateDC(HCLRCONV clrconv, int bpp) HGDI_DC gdi_CreateCompatibleDC(HGDI_DC hdc) { - HGDI_DC hDC = (HGDI_DC) xmalloc(sizeof(GDI_DC)); + HGDI_DC hDC = (HGDI_DC) malloc(sizeof(GDI_DC)); hDC->bytesPerPixel = hdc->bytesPerPixel; hDC->bitsPerPixel = hdc->bitsPerPixel; hDC->drawMode = hdc->drawMode; diff --git a/libfreerdp/gdi/gdi.c b/libfreerdp/gdi/gdi.c index b506e984f..a5c2a1928 100644 --- a/libfreerdp/gdi/gdi.c +++ b/libfreerdp/gdi/gdi.c @@ -376,7 +376,7 @@ gdiBitmap* gdi_glyph_new(rdpGdi* gdi, GLYPH_DATA* glyph) uint8* extra; gdiBitmap* gdi_bmp; - gdi_bmp = (gdiBitmap*) xmalloc(sizeof(gdiBitmap)); + gdi_bmp = (gdiBitmap*) malloc(sizeof(gdiBitmap)); gdi_bmp->hdc = gdi_GetDC(); gdi_bmp->hdc->bytesPerPixel = 1; @@ -408,7 +408,7 @@ gdiBitmap* gdi_bitmap_new_ex(rdpGdi* gdi, int width, int height, int bpp, uint8* { gdiBitmap* bitmap; - bitmap = (gdiBitmap*) xmalloc(sizeof(gdiBitmap)); + bitmap = (gdiBitmap*) malloc(sizeof(gdiBitmap)); bitmap->hdc = gdi_CreateCompatibleDC(gdi->hdc); DEBUG_GDI("gdi_bitmap_new: width:%d height:%d bpp:%d", width, height, bpp); @@ -748,7 +748,7 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_co gdi->image->bitmap->height = surface_bits_command->height; gdi->image->bitmap->bitsPerPixel = surface_bits_command->bpp; gdi->image->bitmap->bytesPerPixel = gdi->image->bitmap->bitsPerPixel / 8; - gdi->image->bitmap->data = (uint8*) xrealloc(gdi->image->bitmap->data, gdi->image->bitmap->width * gdi->image->bitmap->height * 4); + gdi->image->bitmap->data = (uint8*) realloc(gdi->image->bitmap->data, gdi->image->bitmap->width * gdi->image->bitmap->height * 4); freerdp_image_flip(nsc_context->bmpdata, gdi->image->bitmap->data, gdi->image->bitmap->width, gdi->image->bitmap->height, 32); gdi_BitBlt(gdi->primary->hdc, surface_bits_command->destLeft, surface_bits_command->destTop, surface_bits_command->width, surface_bits_command->height, gdi->image->hdc, 0, 0, GDI_SRCCOPY); } @@ -759,7 +759,7 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_co gdi->image->bitmap->bitsPerPixel = surface_bits_command->bpp; gdi->image->bitmap->bytesPerPixel = gdi->image->bitmap->bitsPerPixel / 8; - gdi->image->bitmap->data = (uint8*) xrealloc(gdi->image->bitmap->data, + gdi->image->bitmap->data = (uint8*) realloc(gdi->image->bitmap->data, gdi->image->bitmap->width * gdi->image->bitmap->height * 4); if ((surface_bits_command->bpp != 32) || (gdi->clrconv->alpha == true)) @@ -773,9 +773,9 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_co surface_bits_command->bpp = 32; surface_bits_command->bitmapData = gdi->image->bitmap->data; - temp_image = (uint8*) xmalloc(gdi->image->bitmap->width * gdi->image->bitmap->height * 4); + temp_image = (uint8*) malloc(gdi->image->bitmap->width * gdi->image->bitmap->height * 4); freerdp_image_flip(gdi->image->bitmap->data, temp_image, gdi->image->bitmap->width, gdi->image->bitmap->height, 32); - xfree(gdi->image->bitmap->data); + free(gdi->image->bitmap->data); gdi->image->bitmap->data = temp_image; } else @@ -793,7 +793,7 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits_co } if (tile_bitmap != NULL) - xfree(tile_bitmap); + free(tile_bitmap); } /** @@ -843,12 +843,12 @@ void gdi_init_primary(rdpGdi* gdi) if (gdi->drawing == NULL) gdi->drawing = gdi->primary; - gdi->primary->hdc->hwnd = (HGDI_WND) xmalloc(sizeof(GDI_WND)); + gdi->primary->hdc->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND)); gdi->primary->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0); gdi->primary->hdc->hwnd->invalid->null = 1; gdi->primary->hdc->hwnd->count = 32; - gdi->primary->hdc->hwnd->cinvalid = (HGDI_RGN) xmalloc(sizeof(GDI_RGN) * gdi->primary->hdc->hwnd->count); + gdi->primary->hdc->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * gdi->primary->hdc->hwnd->count); gdi->primary->hdc->hwnd->ninvalid = 0; } @@ -930,11 +930,11 @@ int gdi_init(freerdp* instance, uint32 flags, uint8* buffer) gdi->hdc->bitsPerPixel = gdi->dstBpp; gdi->hdc->bytesPerPixel = gdi->bytesPerPixel; - gdi->clrconv = (HCLRCONV) xmalloc(sizeof(CLRCONV)); + gdi->clrconv = (HCLRCONV) malloc(sizeof(CLRCONV)); gdi->clrconv->alpha = (flags & CLRCONV_ALPHA) ? 1 : 0; gdi->clrconv->invert = (flags & CLRCONV_INVERT) ? 1 : 0; gdi->clrconv->rgb555 = (flags & CLRCONV_RGB555) ? 1 : 0; - gdi->clrconv->palette = (rdpPalette*) xmalloc(sizeof(rdpPalette)); + gdi->clrconv->palette = (rdpPalette*) malloc(sizeof(rdpPalette)); gdi->hdc->alpha = gdi->clrconv->alpha; gdi->hdc->invert = gdi->clrconv->invert; diff --git a/libfreerdp/gdi/graphics.c b/libfreerdp/gdi/graphics.c index b109473af..62415f9f2 100644 --- a/libfreerdp/gdi/graphics.c +++ b/libfreerdp/gdi/graphics.c @@ -108,9 +108,9 @@ void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap, size = width * height * (bpp + 7) / 8; if (bitmap->data == NULL) - bitmap->data = (uint8*) xmalloc(size); + bitmap->data = (uint8*) malloc(size); else - bitmap->data = (uint8*) xrealloc(bitmap->data, size); + bitmap->data = (uint8*) realloc(bitmap->data, size); switch (codec_id) { @@ -274,7 +274,7 @@ void gdi_register_graphics(rdpGraphics* graphics) bitmap->SetSurface = gdi_Bitmap_SetSurface; graphics_register_bitmap(graphics, bitmap); - xfree(bitmap); + free(bitmap); glyph = xnew(rdpGlyph); glyph->size = sizeof(gdiGlyph); @@ -286,5 +286,5 @@ void gdi_register_graphics(rdpGraphics* graphics) glyph->EndDraw = gdi_Glyph_EndDraw; graphics_register_glyph(graphics, glyph); - xfree(glyph); + free(glyph); } diff --git a/libfreerdp/gdi/palette.c b/libfreerdp/gdi/palette.c index 08c04b3c5..d069bf2ed 100644 --- a/libfreerdp/gdi/palette.c +++ b/libfreerdp/gdi/palette.c @@ -71,9 +71,9 @@ static const GDI_PALETTEENTRY default_system_palette[20] = HGDI_PALETTE gdi_CreatePalette(HGDI_PALETTE palette) { - HGDI_PALETTE hPalette = (HGDI_PALETTE) xmalloc(sizeof(GDI_PALETTE)); + HGDI_PALETTE hPalette = (HGDI_PALETTE) malloc(sizeof(GDI_PALETTE)); hPalette->count = palette->count; - hPalette->entries = (GDI_PALETTEENTRY*) xmalloc(sizeof(GDI_PALETTEENTRY) * hPalette->count); + hPalette->entries = (GDI_PALETTEENTRY*) malloc(sizeof(GDI_PALETTEENTRY) * hPalette->count); memcpy(hPalette->entries, palette->entries, sizeof(GDI_PALETTEENTRY) * hPalette->count); return hPalette; } @@ -85,10 +85,10 @@ HGDI_PALETTE gdi_CreatePalette(HGDI_PALETTE palette) HGDI_PALETTE CreateSystemPalette() { - HGDI_PALETTE palette = (HGDI_PALETTE) xmalloc(sizeof(GDI_PALETTE)); + HGDI_PALETTE palette = (HGDI_PALETTE) malloc(sizeof(GDI_PALETTE)); palette->count = 256; - palette->entries = (GDI_PALETTEENTRY*) xmalloc(sizeof(GDI_PALETTEENTRY) * 256); + palette->entries = (GDI_PALETTEENTRY*) malloc(sizeof(GDI_PALETTEENTRY) * 256); memset(palette->entries, 0, sizeof(GDI_PALETTEENTRY) * 256); memcpy(&palette->entries[0], &default_system_palette[0], 10 * sizeof(GDI_PALETTEENTRY)); diff --git a/libfreerdp/gdi/pen.c b/libfreerdp/gdi/pen.c index 1bc9b8484..c727d42c7 100644 --- a/libfreerdp/gdi/pen.c +++ b/libfreerdp/gdi/pen.c @@ -45,7 +45,7 @@ HGDI_PEN gdi_CreatePen(int fnPenStyle, int nWidth, int crColor) { - HGDI_PEN hPen = (HGDI_PEN) xmalloc(sizeof(GDI_PEN)); + HGDI_PEN hPen = (HGDI_PEN) malloc(sizeof(GDI_PEN)); hPen->objectType = GDIOBJECT_PEN; hPen->style = fnPenStyle; hPen->color = crColor; diff --git a/libfreerdp/gdi/region.c b/libfreerdp/gdi/region.c index 496e27fbf..d3147188f 100644 --- a/libfreerdp/gdi/region.c +++ b/libfreerdp/gdi/region.c @@ -44,7 +44,7 @@ HGDI_RGN gdi_CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBottomRect) { - HGDI_RGN hRgn = (HGDI_RGN) xmalloc(sizeof(GDI_RGN)); + HGDI_RGN hRgn = (HGDI_RGN) malloc(sizeof(GDI_RGN)); hRgn->objectType = GDIOBJECT_REGION; hRgn->x = nLeftRect; hRgn->y = nTopRect; @@ -65,7 +65,7 @@ HGDI_RGN gdi_CreateRectRgn(int nLeftRect, int nTopRect, int nRightRect, int nBot HGDI_RECT gdi_CreateRect(int xLeft, int yTop, int xRight, int yBottom) { - HGDI_RECT hRect = (HGDI_RECT) xmalloc(sizeof(GDI_RECT)); + HGDI_RECT hRect = (HGDI_RECT) malloc(sizeof(GDI_RECT)); hRect->objectType = GDIOBJECT_RECT; hRect->left = xLeft; hRect->top = yTop; diff --git a/libfreerdp/locale/keyboard_keymap.c b/libfreerdp/locale/keyboard_keymap.c index f6f487fa8..079463b85 100644 --- a/libfreerdp/locale/keyboard_keymap.c +++ b/libfreerdp/locale/keyboard_keymap.c @@ -80,10 +80,10 @@ int freerdp_keyboard_load_map(uint32 keycode_to_vkcode[256], char* name) if ((fp = fopen(keymap_path, "r")) == NULL) { DEBUG_KBD("%s not found", keymap_path); - xfree(keymap_path); + free(keymap_path); return 0; } - xfree(keymap_path); + free(keymap_path); while (fgets(buffer, sizeof(buffer), fp) != NULL) { diff --git a/libfreerdp/locale/keyboard_layout.c b/libfreerdp/locale/keyboard_layout.c index 04d012e31..20bda4950 100644 --- a/libfreerdp/locale/keyboard_layout.c +++ b/libfreerdp/locale/keyboard_layout.c @@ -482,12 +482,12 @@ RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(uint32 types) RDP_KEYBOARD_LAYOUT* layouts; num = 0; - layouts = (RDP_KEYBOARD_LAYOUT*) xmalloc((num + 1) * sizeof(RDP_KEYBOARD_LAYOUT)); + layouts = (RDP_KEYBOARD_LAYOUT*) malloc((num + 1) * sizeof(RDP_KEYBOARD_LAYOUT)); if ((types & RDP_KEYBOARD_LAYOUT_TYPE_STANDARD) != 0) { length = ARRAY_SIZE(RDP_KEYBOARD_LAYOUT_TABLE); - layouts = (RDP_KEYBOARD_LAYOUT*) xrealloc(layouts, (num + length + 1) * sizeof(RDP_KEYBOARD_LAYOUT)); + layouts = (RDP_KEYBOARD_LAYOUT*) realloc(layouts, (num + length + 1) * sizeof(RDP_KEYBOARD_LAYOUT)); for (i = 0; i < length; i++, num++) { @@ -498,7 +498,7 @@ RDP_KEYBOARD_LAYOUT* freerdp_keyboard_get_layouts(uint32 types) if ((types & RDP_KEYBOARD_LAYOUT_TYPE_VARIANT) != 0) { length = ARRAY_SIZE(RDP_KEYBOARD_LAYOUT_VARIANT_TABLE); - layouts = (RDP_KEYBOARD_LAYOUT*) xrealloc(layouts, (num + length + 1) * sizeof(RDP_KEYBOARD_LAYOUT)); + layouts = (RDP_KEYBOARD_LAYOUT*) realloc(layouts, (num + length + 1) * sizeof(RDP_KEYBOARD_LAYOUT)); for (i = 0; i < length; i++, num++) { diff --git a/libfreerdp/locale/keyboard_x11.c b/libfreerdp/locale/keyboard_x11.c index 55737d697..3996ccd30 100644 --- a/libfreerdp/locale/keyboard_x11.c +++ b/libfreerdp/locale/keyboard_x11.c @@ -194,7 +194,7 @@ char* freerdp_detect_keymap_from_xkb() *end = '\0'; length = (end - beg); - keymap = (char*) xmalloc(length + 1); + keymap = (char*) malloc(length + 1); strncpy(keymap, beg, length); keymap[length] = '\0'; @@ -236,8 +236,8 @@ uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId, RDP_SCANCODE x11_keyco if (keyboardLayoutId == 0) { keyboardLayoutId = freerdp_detect_keyboard_layout_from_xkb(&xkb_layout, &xkb_variant); - xfree(xkb_layout); - xfree(xkb_variant); + free(xkb_layout); + free(xkb_variant); } keymap = freerdp_detect_keymap_from_xkb(); @@ -245,7 +245,7 @@ uint32 freerdp_keyboard_init_x11(uint32 keyboardLayoutId, RDP_SCANCODE x11_keyco if (keymap != NULL) { freerdp_keyboard_load_maps(keycode_to_vkcode, keymap); - xfree(keymap); + free(keymap); } } #endif diff --git a/libfreerdp/locale/keyboard_xkbfile.c b/libfreerdp/locale/keyboard_xkbfile.c index 7e1c000b8..991603e35 100644 --- a/libfreerdp/locale/keyboard_xkbfile.c +++ b/libfreerdp/locale/keyboard_xkbfile.c @@ -23,6 +23,8 @@ #include "keyboard_xkbfile.h" +#include +#include #include #include @@ -257,10 +259,10 @@ uint32 detect_keyboard_layout_from_xkbfile(void* display) keyboard_layout = find_keyboard_layout_in_xorg_rules(layout, variant); - xfree(rules_names.model); - xfree(rules_names.layout); - xfree(rules_names.variant); - xfree(rules_names.options); + free(rules_names.model); + free(rules_names.layout); + free(rules_names.variant); + free(rules_names.options); } return keyboard_layout; diff --git a/libfreerdp/locale/timezone.c b/libfreerdp/locale/timezone.c index 895374f7a..2d98eecbd 100644 --- a/libfreerdp/locale/timezone.c +++ b/libfreerdp/locale/timezone.c @@ -1520,7 +1520,7 @@ char* freerdp_get_unix_timezone_identifier() return NULL; } - tzid = (char*) xmalloc(length + 1); + tzid = (char*) malloc(length + 1); fread(tzid, length, 1, fp); tzid[length] = '\0'; @@ -1558,7 +1558,7 @@ char* freerdp_get_unix_timezone_identifier() num++; } - tzid = (char*) xmalloc(len - pos + 1); + tzid = (char*) malloc(len - pos + 1); strncpy(tzid, buf + pos + 1, len - pos); return tzid; @@ -1584,14 +1584,14 @@ boolean freerdp_match_unix_timezone_identifier_with_list(const char* tzid, const { if (strcmp(p, tzid) == 0) { - xfree(list_copy); + free(list_copy); return true; } p = strtok(NULL, " "); } - xfree(list_copy); + free(list_copy); return false; } @@ -1616,17 +1616,17 @@ TIME_ZONE_ENTRY* freerdp_detect_windows_time_zone(uint32 bias) if (freerdp_match_unix_timezone_identifier_with_list(tzid, WindowsTimeZoneIdTable[j].tzid)) { - timezone = (TIME_ZONE_ENTRY*) xmalloc(sizeof(TIME_ZONE_ENTRY)); + timezone = (TIME_ZONE_ENTRY*) malloc(sizeof(TIME_ZONE_ENTRY)); memcpy((void*) timezone, (void*) &TimeZoneTable[i], sizeof(TIME_ZONE_ENTRY)); timezone->Bias = bias; - xfree(tzid); + free(tzid); return timezone; } } } printf("Unable to find a match for unix timezone: %s\n", tzid); - xfree(tzid); + free(tzid); return NULL; } @@ -1730,7 +1730,7 @@ void freerdp_time_zone_detect(TIME_ZONE_INFO* clientTimeZone) */ } - xfree(tz); + free(tz); } else { diff --git a/libfreerdp/rail/icon.c b/libfreerdp/rail/icon.c index d44e34829..5ab656c06 100644 --- a/libfreerdp/rail/icon.c +++ b/libfreerdp/rail/icon.c @@ -105,12 +105,12 @@ void icon_cache_free(rdpIconCache* cache) for (i = 0; i < cache->numCaches; i++) { - xfree(cache->caches[i].entries); + free(cache->caches[i].entries); } - xfree(cache->caches); + free(cache->caches); - xfree(cache); + free(cache); } } diff --git a/libfreerdp/rail/rail.c b/libfreerdp/rail/rail.c index f79f8a10b..072205cf5 100644 --- a/libfreerdp/rail/rail.c +++ b/libfreerdp/rail/rail.c @@ -160,7 +160,7 @@ void rail_free(rdpRail* rail) { icon_cache_free(rail->cache); window_list_free(rail->list); - xfree(rail->clrconv); - xfree(rail); + free(rail->clrconv); + free(rail); } } diff --git a/libfreerdp/rail/window.c b/libfreerdp/rail/window.c index 26dfee661..bfec8f62d 100644 --- a/libfreerdp/rail/window.c +++ b/libfreerdp/rail/window.c @@ -172,7 +172,7 @@ void window_state_update(rdpWindow* window, WINDOW_ORDER_INFO* orderInfo, WINDOW if (orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TITLE) { window->titleInfo.length = window_state->titleInfo.length; - window->titleInfo.string = xmalloc(window_state->titleInfo.length); + window->titleInfo.string = malloc(window_state->titleInfo.length); memcpy(window->titleInfo.string, window_state->titleInfo.string, window->titleInfo.length); #ifdef WITH_DEBUG_RAIL @@ -240,7 +240,7 @@ void window_state_update(rdpWindow* window, WINDOW_ORDER_INFO* orderInfo, WINDOW int i; if (window->windowRects != NULL) - xfree(window->windowRects); + free(window->windowRects); window->windowRects = window_state->windowRects; window->numWindowRects = window_state->numWindowRects; @@ -267,7 +267,7 @@ void window_state_update(rdpWindow* window, WINDOW_ORDER_INFO* orderInfo, WINDOW int i; if (window->visibilityRects != NULL) - xfree(window->visibilityRects); + free(window->visibilityRects); window->visibilityRects = window_state->visibilityRects; window->numVisibilityRects = window_state->numVisibilityRects; @@ -289,7 +289,7 @@ void rail_CreateWindow(rdpRail* rail, rdpWindow* window) } else { - window->title = (char*) xmalloc(sizeof("RAIL")); + window->title = (char*) malloc(sizeof("RAIL")); memcpy(window->title, "RAIL", sizeof("RAIL")); } @@ -325,7 +325,7 @@ void rail_UpdateWindow(rdpRail* rail, rdpWindow* window) if (window->fieldFlags & WINDOW_ORDER_FIELD_TITLE) { if (window->title != NULL) - xfree(window->title); + free(window->title); freerdp_UnicodeToAsciiAlloc((WCHAR*) window->titleInfo.string, &window->title, window->titleInfo.length / 2); @@ -385,6 +385,6 @@ void rail_DestroyWindow(rdpRail* rail, rdpWindow* window) if (window != NULL) { - xfree(window); + free(window); } } diff --git a/libfreerdp/rail/window_list.c b/libfreerdp/rail/window_list.c index b4221dfef..8f8e7c2c8 100644 --- a/libfreerdp/rail/window_list.c +++ b/libfreerdp/rail/window_list.c @@ -223,6 +223,6 @@ void window_list_free(rdpWindowList* list) { if (list != NULL) { - xfree(list); + free(list); } } diff --git a/libfreerdp/utils/args.c b/libfreerdp/utils/args.c index 921e4e340..651490b56 100644 --- a/libfreerdp/utils/args.c +++ b/libfreerdp/utils/args.c @@ -714,9 +714,9 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, while (index < argc && strcmp("--", argv[index]) != 0) { if (plugin_data == NULL) - plugin_data = (RDP_PLUGIN_DATA*) xmalloc(sizeof(RDP_PLUGIN_DATA) * (i + 2)); + plugin_data = (RDP_PLUGIN_DATA*) malloc(sizeof(RDP_PLUGIN_DATA) * (i + 2)); else - plugin_data = (RDP_PLUGIN_DATA*) xrealloc(plugin_data, sizeof(RDP_PLUGIN_DATA) * (i + 2)); + plugin_data = (RDP_PLUGIN_DATA*) realloc(plugin_data, sizeof(RDP_PLUGIN_DATA) * (i + 2)); if (strstr(argv[t], "drdynvc") && strstr(argv[index], "audin")) settings->audio_capture = true; @@ -879,7 +879,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv, } /* password */ if (NULL == settings->password) { - settings->password = xmalloc(512 * sizeof(char)); + settings->password = malloc(512 * sizeof(char)); if (isatty(STDIN_FILENO)) freerdp_passphrase_read("password: ", settings->password, 512, settings->from_stdin); else { diff --git a/libfreerdp/utils/dsp.c b/libfreerdp/utils/dsp.c index 5a4cc3394..673dc59eb 100644 --- a/libfreerdp/utils/dsp.c +++ b/libfreerdp/utils/dsp.c @@ -50,7 +50,7 @@ static void freerdp_dsp_resample(FREERDP_DSP_CONTEXT* context, if (rsize > (int) context->resampled_maxlength) { context->resampled_maxlength = rsize + 1024; - context->resampled_buffer = (uint8*) xrealloc(context->resampled_buffer, context->resampled_maxlength); + context->resampled_buffer = (uint8*) realloc(context->resampled_buffer, context->resampled_maxlength); } dst = context->resampled_buffer; @@ -148,7 +148,7 @@ static void freerdp_dsp_decode_ima_adpcm(FREERDP_DSP_CONTEXT* context, if (out_size > context->adpcm_maxlength) { context->adpcm_maxlength = out_size + 1024; - context->adpcm_buffer = xrealloc(context->adpcm_buffer, context->adpcm_maxlength); + context->adpcm_buffer = realloc(context->adpcm_buffer, context->adpcm_maxlength); } dst = context->adpcm_buffer; while (size > 0) @@ -307,7 +307,7 @@ static void freerdp_dsp_encode_ima_adpcm(FREERDP_DSP_CONTEXT* context, if (out_size > context->adpcm_maxlength) { context->adpcm_maxlength = out_size + 1024; - context->adpcm_buffer = xrealloc(context->adpcm_buffer, context->adpcm_maxlength); + context->adpcm_buffer = realloc(context->adpcm_buffer, context->adpcm_maxlength); } dst = context->adpcm_buffer; while (size > 0) @@ -410,7 +410,7 @@ static void freerdp_dsp_decode_ms_adpcm(FREERDP_DSP_CONTEXT* context, if (out_size > context->adpcm_maxlength) { context->adpcm_maxlength = out_size + 1024; - context->adpcm_buffer = xrealloc(context->adpcm_buffer, context->adpcm_maxlength); + context->adpcm_buffer = realloc(context->adpcm_buffer, context->adpcm_maxlength); } dst = context->adpcm_buffer; while (size > 0) @@ -530,7 +530,7 @@ static void freerdp_dsp_encode_ms_adpcm(FREERDP_DSP_CONTEXT* context, if (out_size > context->adpcm_maxlength) { context->adpcm_maxlength = out_size + 1024; - context->adpcm_buffer = xrealloc(context->adpcm_buffer, context->adpcm_maxlength); + context->adpcm_buffer = realloc(context->adpcm_buffer, context->adpcm_maxlength); } dst = context->adpcm_buffer; @@ -611,9 +611,9 @@ void freerdp_dsp_context_free(FREERDP_DSP_CONTEXT* context) if (context) { if (context->resampled_buffer) - xfree(context->resampled_buffer); + free(context->resampled_buffer); if (context->adpcm_buffer) - xfree(context->adpcm_buffer); - xfree(context); + free(context->adpcm_buffer); + free(context); } } diff --git a/libfreerdp/utils/event.c b/libfreerdp/utils/event.c index 606f3ebeb..91608da96 100644 --- a/libfreerdp/utils/event.c +++ b/libfreerdp/utils/event.c @@ -117,14 +117,14 @@ static void freerdp_cliprdr_event_free(RDP_EVENT* event) case RDP_EVENT_TYPE_CB_FORMAT_LIST: { RDP_CB_FORMAT_LIST_EVENT* cb_event = (RDP_CB_FORMAT_LIST_EVENT*)event; - xfree(cb_event->formats); - xfree(cb_event->raw_format_data); + free(cb_event->formats); + free(cb_event->raw_format_data); } break; case RDP_EVENT_TYPE_CB_DATA_RESPONSE: { RDP_CB_DATA_RESPONSE_EVENT* cb_event = (RDP_CB_DATA_RESPONSE_EVENT*)event; - xfree(cb_event->data); + free(cb_event->data); } break; } @@ -137,8 +137,8 @@ static void freerdp_tsmf_event_free(RDP_EVENT* event) case RDP_EVENT_TYPE_TSMF_VIDEO_FRAME: { RDP_VIDEO_FRAME_EVENT* vevent = (RDP_VIDEO_FRAME_EVENT*)event; - xfree(vevent->frame_data); - xfree(vevent->visible_rects); + free(vevent->frame_data); + free(vevent->visible_rects); } break; } @@ -167,6 +167,6 @@ void freerdp_event_free(RDP_EVENT* event) freerdp_rail_event_free(event); break; } - xfree(event); + free(event); } } diff --git a/libfreerdp/utils/file.c b/libfreerdp/utils/file.c index 1fddca77b..076201005 100644 --- a/libfreerdp/utils/file.c +++ b/libfreerdp/utils/file.c @@ -97,7 +97,7 @@ char* freerdp_get_config_path(rdpSettings* settings) if (settings->config_path != NULL) return settings->config_path; - settings->config_path = (char*) xmalloc(strlen(settings->home_path) + sizeof(FREERDP_CONFIG_DIR) + 2); + settings->config_path = (char*) malloc(strlen(settings->home_path) + sizeof(FREERDP_CONFIG_DIR) + 2); sprintf(settings->config_path, "%s" PATH_SEPARATOR_STR "%s", settings->home_path, FREERDP_CONFIG_DIR); if (!freerdp_check_file_exists(settings->config_path)) @@ -125,7 +125,7 @@ char* freerdp_construct_path(char* base_path, char* relative_path) relative_path_length = strlen(relative_path); length = base_path_length + relative_path_length + 1; - path = xmalloc(length + 1); + path = malloc(length + 1); sprintf(path, "%s" PATH_SEPARATOR_STR "%s", base_path, relative_path); return path; @@ -150,7 +150,7 @@ char* freerdp_append_shared_library_suffix(char* file_path) if (strcmp(p, SHARED_LIB_SUFFIX) != 0) { - path = xmalloc(file_path_length + shared_lib_suffix_length + 1); + path = malloc(file_path_length + shared_lib_suffix_length + 1); sprintf(path, "%s%s", file_path, SHARED_LIB_SUFFIX); } else @@ -160,7 +160,7 @@ char* freerdp_append_shared_library_suffix(char* file_path) } else { - path = xmalloc(file_path_length + shared_lib_suffix_length + 1); + path = malloc(file_path_length + shared_lib_suffix_length + 1); sprintf(path, "%s%s", file_path, SHARED_LIB_SUFFIX); } @@ -196,7 +196,7 @@ char* freerdp_get_parent_path(char* base_path, int depth) length = (p - base_path); - path = (char*) xmalloc(length + 1); + path = (char*) malloc(length + 1); memcpy(path, base_path, length); path[length] = '\0'; diff --git a/libfreerdp/utils/list.c b/libfreerdp/utils/list.c index dfd9632ca..89cb1f41d 100644 --- a/libfreerdp/utils/list.c +++ b/libfreerdp/utils/list.c @@ -98,7 +98,7 @@ void list_free(LIST* list) { while (list->head) list_dequeue(list); - xfree(list); + free(list); } /** @@ -149,7 +149,7 @@ void* list_dequeue(LIST* list) list->head->prev = NULL; data = item->data; - xfree(item); + free(item); list->count--; } return data; @@ -221,7 +221,7 @@ void* list_remove(LIST* list, void* data) list->head = item->next; if (list->tail == item) list->tail = item->prev; - xfree(item); + free(item); list->count--; } else diff --git a/libfreerdp/utils/load_plugin.c b/libfreerdp/utils/load_plugin.c index 827b925f2..607f32144 100644 --- a/libfreerdp/utils/load_plugin.c +++ b/libfreerdp/utils/load_plugin.c @@ -134,8 +134,8 @@ void* freerdp_load_plugin(const char* name, const char* entry_name) entry = freerdp_load_library_symbol(path, entry_name); - xfree(suffixed_name); - xfree(path); + free(suffixed_name); + free(path); if (entry == NULL) { diff --git a/libfreerdp/utils/memory.c b/libfreerdp/utils/memory.c index 8bffc9344..3cc2a69e1 100644 --- a/libfreerdp/utils/memory.c +++ b/libfreerdp/utils/memory.c @@ -27,34 +27,6 @@ #include -/** - * Allocate memory. - * This function is used to secure a malloc call. - * It verifies its return value, and logs an error if the allocation failed. - * - * @param size - number of bytes to allocate. If the size is < 1, it will default to 1. - * - * @return a pointer to the allocated buffer. NULL if the allocation failed. - */ - -void* xmalloc(size_t size) -{ - void* mem; - - if (size < 1) - size = 1; - - mem = malloc(size); - - if (mem == NULL) - { - perror("xmalloc"); - printf("xmalloc: failed to allocate memory of size: %d\n", (int) size); - } - - return mem; -} - /** * Allocate memory initialized to zero. * This function is used to secure a calloc call. @@ -82,46 +54,6 @@ void* xzalloc(size_t size) return mem; } -/** - * Reallocate memory. - * This function is used to secure a realloc call. - * It verifies its return value, and logs an error if the allocation failed. - * - * @param ptr - pointer to the buffer that needs reallocation. This can be NULL, in which case a new buffer is allocated. - * @param size - number of bytes to allocate. If the size is < 1, it will default to 1. - * - * @return a pointer to the reallocated buffer. NULL if the allocation failed (in which case the 'ptr' argument is untouched). - */ - -void* xrealloc(void* ptr, size_t size) -{ - void* mem; - - if (size < 1) - size = 1; - - mem = realloc(ptr, size); - - if (mem == NULL) - perror("xrealloc"); - - return mem; -} - -/** - * Free memory. - * This function is used to secure a free call. - * It verifies that the pointer is valid (non-NULL) before trying to deallocate it's buffer. - * - * @param ptr - pointer to a buffer that needs deallocation. If ptr is NULL, nothing will be done (no segfault). - */ - -void xfree(void* ptr) -{ - if (ptr != NULL) - free(ptr); -} - /** * Duplicate a string in memory. * This function is used to secure the strdup function. @@ -176,7 +108,7 @@ wchar_t* xwcsdup(const wchar_t* wstr) #elif sun mem = wsdup(wstr); #elif (defined(__APPLE__) && defined(__MACH__)) || defined(ANDROID) - mem = xmalloc(wcslen(wstr) * sizeof(wchar_t)); + mem = malloc(wcslen(wstr) * sizeof(wchar_t)); if (mem != NULL) wcscpy(mem, wstr); #else diff --git a/libfreerdp/utils/pcap.c b/libfreerdp/utils/pcap.c index cb1987f63..93dde00d7 100644 --- a/libfreerdp/utils/pcap.c +++ b/libfreerdp/utils/pcap.c @@ -22,6 +22,7 @@ #endif #include +#include #include #ifndef _WIN32 @@ -72,7 +73,7 @@ void pcap_read_record(rdpPcap* pcap, pcap_record* record) { pcap_read_record_header(pcap, &record->header); record->length = record->header.incl_len; - record->data = xmalloc(record->length); + record->data = malloc(record->length); fread(record->data, record->length, 1, pcap->fp); } diff --git a/libfreerdp/utils/profiler.c b/libfreerdp/utils/profiler.c index db0f8e256..3b52c72d0 100644 --- a/libfreerdp/utils/profiler.c +++ b/libfreerdp/utils/profiler.c @@ -22,6 +22,7 @@ #endif #include +#include #include @@ -29,7 +30,7 @@ PROFILER* profiler_create(char* name) { PROFILER* profiler; - profiler = (PROFILER*) xmalloc(sizeof(PROFILER)); + profiler = (PROFILER*) malloc(sizeof(PROFILER)); profiler->name = name; profiler->stopwatch = stopwatch_create(); @@ -41,7 +42,7 @@ void profiler_free(PROFILER* profiler) { stopwatch_free(profiler->stopwatch); - xfree(profiler); + free(profiler); } void profiler_enter(PROFILER* profiler) diff --git a/libfreerdp/utils/rail.c b/libfreerdp/utils/rail.c index d8c07e758..fa9b535cf 100644 --- a/libfreerdp/utils/rail.c +++ b/libfreerdp/utils/rail.c @@ -21,16 +21,21 @@ #include "config.h" #endif +#include +#include + #include -#include #include +#include + #include void rail_unicode_string_alloc(RAIL_UNICODE_STRING* unicode_string, uint16 cbString) { unicode_string->length = cbString; - unicode_string->string = xzalloc(cbString); + unicode_string->string = malloc(cbString); + memset(unicode_string->string, 0, cbString); } void rail_unicode_string_free(RAIL_UNICODE_STRING* unicode_string) @@ -38,7 +43,7 @@ void rail_unicode_string_free(RAIL_UNICODE_STRING* unicode_string) unicode_string->length = 0; if (unicode_string->string != NULL) - xfree(unicode_string->string); + free(unicode_string->string); } void rail_read_unicode_string(STREAM* s, RAIL_UNICODE_STRING* unicode_string) @@ -46,9 +51,9 @@ void rail_read_unicode_string(STREAM* s, RAIL_UNICODE_STRING* unicode_string) stream_read_uint16(s, unicode_string->length); /* cbString (2 bytes) */ if (unicode_string->string == NULL) - unicode_string->string = (uint8*) xmalloc(unicode_string->length); + unicode_string->string = (uint8*) malloc(unicode_string->length); else - unicode_string->string = (uint8*) xrealloc(unicode_string->string, unicode_string->length); + unicode_string->string = (uint8*) realloc(unicode_string->string, unicode_string->length); stream_read(s, unicode_string->string, unicode_string->length); } @@ -126,7 +131,7 @@ void* rail_clone_order(uint32 event_type, void* order) // Event type not found. if (order_size == 0) return NULL; - new_order = xmalloc(order_size); + new_order = malloc(order_size); memcpy(new_order, order, order_size); //printf("rail_clone_order: type=%d order=%p\n", event_type, new_order); @@ -184,5 +189,5 @@ void rail_free_cloned_order(uint32 event_type, void* order) RAIL_EXEC_RESULT_ORDER* exec_result = (RAIL_EXEC_RESULT_ORDER*)order; rail_unicode_string_free(&exec_result->exeOrFile); } - xfree(order); + free(order); } diff --git a/libfreerdp/utils/stopwatch.c b/libfreerdp/utils/stopwatch.c index 730cf41db..c1f3f4d8e 100644 --- a/libfreerdp/utils/stopwatch.c +++ b/libfreerdp/utils/stopwatch.c @@ -21,13 +21,16 @@ #include "config.h" #endif +#include +#include + #include STOPWATCH* stopwatch_create() { STOPWATCH* sw; - sw = (STOPWATCH*) xmalloc(sizeof(STOPWATCH)); + sw = (STOPWATCH*) malloc(sizeof(STOPWATCH)); stopwatch_reset(sw); return sw; @@ -35,7 +38,7 @@ STOPWATCH* stopwatch_create() void stopwatch_free(STOPWATCH* stopwatch) { - xfree(stopwatch); + free(stopwatch); } void stopwatch_start(STOPWATCH* stopwatch) diff --git a/libfreerdp/utils/stream.c b/libfreerdp/utils/stream.c index 85dc729bb..13e05041b 100644 --- a/libfreerdp/utils/stream.c +++ b/libfreerdp/utils/stream.c @@ -79,9 +79,9 @@ void stream_free(STREAM* stream) if (stream != NULL) { if (stream->data != NULL) - xfree(stream->data); + free(stream->data); - xfree(stream); + free(stream); } } @@ -107,9 +107,9 @@ void stream_extend(STREAM* stream, int request_size) stream->size += increased_size; if (original_size == 0) - stream->data = (uint8*) xmalloc(stream->size); + stream->data = (uint8*) malloc(stream->size); else - stream->data = (uint8*) xrealloc(stream->data, stream->size); + stream->data = (uint8*) realloc(stream->data, stream->size); memset(stream->data + original_size, 0, increased_size); stream_set_pos(stream, pos); diff --git a/libfreerdp/utils/string.c b/libfreerdp/utils/string.c index 9695a2eab..e79c926b9 100644 --- a/libfreerdp/utils/string.c +++ b/libfreerdp/utils/string.c @@ -21,7 +21,10 @@ #include "config.h" #endif -#include +#include +#include +#include + #include #include @@ -29,7 +32,7 @@ void freerdp_string_read_length32(STREAM* s, rdpString* string) { stream_read_uint32(s, string->length); - string->unicode = (char*) xmalloc(string->length); + string->unicode = (char*) malloc(string->length); stream_read(s, string->unicode, string->length); freerdp_UnicodeToAsciiAlloc((WCHAR*) string->unicode, &string->ascii, string->length / 2); } @@ -37,8 +40,8 @@ void freerdp_string_read_length32(STREAM* s, rdpString* string) void freerdp_string_free(rdpString* string) { if (string->unicode != NULL) - xfree(string->unicode); + free(string->unicode); if (string->ascii != NULL) - xfree(string->ascii); + free(string->ascii); } diff --git a/libfreerdp/utils/svc_plugin.c b/libfreerdp/utils/svc_plugin.c index 904556993..4824f6e90 100644 --- a/libfreerdp/utils/svc_plugin.c +++ b/libfreerdp/utils/svc_plugin.c @@ -69,7 +69,7 @@ static void svc_data_in_item_free(svc_data_in_item* item) freerdp_event_free(item->event_in); item->event_in = NULL; } - xfree(item); + free(item); } struct rdp_svc_plugin_private @@ -145,7 +145,7 @@ static void svc_plugin_remove(rdpSvcPlugin* plugin) prev->next = list->next; else g_svc_plugin_list = list->next; - xfree(list); + free(list); } ReleaseMutex(g_mutex); } @@ -264,7 +264,7 @@ static void svc_plugin_process_data_in(rdpSvcPlugin* plugin) IFCALL(plugin->receive_callback, plugin, item->data_in); if (item->event_in) IFCALL(plugin->event_callback, plugin, item->event_in); - xfree(item); + free(item); } else break; @@ -330,7 +330,7 @@ static void svc_plugin_process_terminated(rdpSvcPlugin* plugin) freerdp_thread_free(plugin->priv->thread); plugin->channel_entry_points.pVirtualChannelClose(plugin->priv->open_handle); - xfree(plugin->channel_entry_points.pExtendedData); + free(plugin->channel_entry_points.pExtendedData); svc_plugin_remove(plugin); @@ -343,7 +343,7 @@ static void svc_plugin_process_terminated(rdpSvcPlugin* plugin) stream_free(plugin->priv->data_in); plugin->priv->data_in = NULL; } - xfree(plugin->priv); + free(plugin->priv); plugin->priv = NULL; IFCALL(plugin->terminate_callback, plugin); diff --git a/libfreerdp/utils/thread.c b/libfreerdp/utils/thread.c index 5100265a0..98be69148 100644 --- a/libfreerdp/utils/thread.c +++ b/libfreerdp/utils/thread.c @@ -93,5 +93,5 @@ void freerdp_thread_free(freerdp_thread* thread) CloseHandle(thread->mutex); thread->mutex = NULL; - xfree(thread); + free(thread); } diff --git a/libfreerdp/utils/wait_obj.c b/libfreerdp/utils/wait_obj.c index 5f9240c99..a38603530 100644 --- a/libfreerdp/utils/wait_obj.c +++ b/libfreerdp/utils/wait_obj.c @@ -64,7 +64,7 @@ wait_obj_new(void) if (pipe(obj->pipe_fd) < 0) { printf("wait_obj_new: pipe failed\n"); - xfree(obj); + free(obj); return NULL; } #endif @@ -117,7 +117,7 @@ wait_obj_free(struct wait_obj* obj) #endif } - xfree(obj); + free(obj); } } @@ -219,7 +219,7 @@ wait_obj_select(struct wait_obj** listobj, int numobj, int timeout) status = -1; else status = 0; - xfree(hnds); + free(hnds); #endif return status; diff --git a/server/Sample/sfreerdp.c b/server/Sample/sfreerdp.c index 14ce1085c..ae9332b5a 100644 --- a/server/Sample/sfreerdp.c +++ b/server/Sample/sfreerdp.c @@ -79,8 +79,8 @@ void test_peer_context_free(freerdp_peer* client, testPeerContext* context) } stream_free(context->s); - xfree(context->icon_data); - xfree(context->bg_data); + free(context->icon_data); + free(context->bg_data); rfx_context_free(context->rfx_context); nsc_context_free(context->nsc_context); @@ -160,7 +160,7 @@ static void test_peer_draw_background(freerdp_peer* client) rect.height = client->settings->height; size = rect.width * rect.height * 3; - rgb_data = xmalloc(size); + rgb_data = malloc(size); memset(rgb_data, 0xA0, size); if (client->settings->rfx_codec) @@ -187,7 +187,7 @@ static void test_peer_draw_background(freerdp_peer* client) cmd->bitmapData = stream_get_head(s); update->SurfaceBits(update->context, cmd); - xfree(rgb_data); + free(rgb_data); test_peer_end_frame(client); } @@ -217,7 +217,7 @@ static void test_peer_load_icon(freerdp_peer* client) /* Max */ fgets(line, sizeof(line), fp); - rgb_data = xmalloc(context->icon_width * context->icon_height * 3); + rgb_data = malloc(context->icon_width * context->icon_height * 3); for (i = 0; i < context->icon_width * context->icon_height * 3; i++) { @@ -231,7 +231,7 @@ static void test_peer_load_icon(freerdp_peer* client) context->icon_data = rgb_data; /* background with same size, which will be used to erase the icon from old position */ - context->bg_data = xmalloc(context->icon_width * context->icon_height * 3); + context->bg_data = malloc(context->icon_width * context->icon_height * 3); memset(context->bg_data, 0xA0, context->icon_width * context->icon_height * 3); } @@ -380,7 +380,7 @@ void tf_peer_dump_rfx(freerdp_peer* client) { pcap_get_next_record_header(pcap_rfx, &record); - s->data = xrealloc(s->data, record.length); + s->data = realloc(s->data, record.length); record.data = s->data; s->size = record.length; diff --git a/server/X11/xf_event.c b/server/X11/xf_event.c index b31cf5456..5086a5ca3 100644 --- a/server/X11/xf_event.c +++ b/server/X11/xf_event.c @@ -96,7 +96,7 @@ void xf_event_push(xfEventQueue* event_queue, xfEvent* event) if (event_queue->count >= event_queue->size) { event_queue->size *= 2; - event_queue->events = (xfEvent**) xrealloc((void*) event_queue->events, sizeof(xfEvent*) * event_queue->size); + event_queue->events = (xfEvent**) realloc((void*) event_queue->events, sizeof(xfEvent*) * event_queue->size); } event_queue->events[(event_queue->count)++] = event; @@ -161,7 +161,7 @@ xfEventRegion* xf_event_region_new(int x, int y, int width, int height) void xf_event_region_free(xfEventRegion* event_region) { - xfree(event_region); + free(event_region); } xfEvent* xf_event_new(int type) @@ -173,7 +173,7 @@ xfEvent* xf_event_new(int type) void xf_event_free(xfEvent* event) { - xfree(event); + free(event); } xfEventQueue* xf_event_queue_new() diff --git a/server/X11/xf_peer.c b/server/X11/xf_peer.c index 9833ce60a..9e4755c13 100644 --- a/server/X11/xf_peer.c +++ b/server/X11/xf_peer.c @@ -381,7 +381,7 @@ void xf_peer_dump_rfx(freerdp_peer* client) { pcap_get_next_record_header(pcap_rfx, &record); - s->data = xrealloc(s->data, record.length); + s->data = realloc(s->data, record.length); record.data = s->data; s->size = record.length;