From 8e88983a62e37b402b913de79ea21f6f0d8077e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Thu, 9 Feb 2012 20:32:08 -0500 Subject: [PATCH] libfreerdp-utils: re-introduce free(NULL) check in xfree() --- libfreerdp-utils/memory.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libfreerdp-utils/memory.c b/libfreerdp-utils/memory.c index 2e2a11a17..d4d17a620 100644 --- a/libfreerdp-utils/memory.c +++ b/libfreerdp-utils/memory.c @@ -40,7 +40,7 @@ void* xmalloc(size_t size) if (mem == NULL) { perror("xmalloc"); - printf("xmalloc: failed to allocate memory of size: %d\n", size); + printf("xmalloc: failed to allocate memory of size: %d\n", (int) size); } return mem; @@ -63,7 +63,7 @@ void* xzalloc(size_t size) if (mem == NULL) { perror("xzalloc"); - printf("xzalloc: failed to allocate memory of size: %d\n", size); + printf("xzalloc: failed to allocate memory of size: %d\n", (int) size); } return mem; @@ -103,6 +103,7 @@ void* xrealloc(void* ptr, size_t size) void xfree(void* ptr) { + if (ptr != NULL) free(ptr); }