Skip to contentSkip to conversation

tools:proc/alloc.c: remove explicit NULL check before free

PATCH In review Maninder Singh 1 participant 1 message Jun 10, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 2/8 tools:proc/alloc.c: remove explicit NULL check before free

No need of NULL check before free

---
 tools/top-LTP/proc/alloc.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/top-LTP/proc/alloc.c +1 -2
index c8cad61..a06fd71 100644
@@ -12,8 +12,7 @@
 void *xcalloc(void *pointer, int size)
 {
 	void *ret;
-	if (pointer)
-		free(pointer);
+	free(pointer);
 	if (!(ret = calloc(1, size))) {
 		fprintf(stderr, "xcalloc: allocation error, size = %d\n", size);
 		exit(1);
Signature · 6 lines
1.7.9.5
------------------------------------------------------------------------------
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list