[PATCH libdrm 3/3] xf86drm: simplify drmMalloc/drmFree

Emil Velikov emil.l.velikov at gmail.com
Tue Apr 28 07:09:59 PDT 2015


Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 xf86drm.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/xf86drm.c b/xf86drm.c
index f7c45f8..9cd0b02 100644
--- a/xf86drm.c
+++ b/xf86drm.c
@@ -140,16 +140,12 @@ void *drmGetHashTable(void)
 
 void *drmMalloc(int size)
 {
-    void *pt;
-    if ((pt = malloc(size)))
-	memset(pt, 0, size);
-    return pt;
+    return calloc(1, size);
 }
 
 void drmFree(void *pt)
 {
-    if (pt)
-	free(pt);
+    free(pt);
 }
 
 /**
-- 
2.3.5



More information about the dri-devel mailing list