[PATCH:xscope 04/14] Use calloc() instead of malloc(); bzero();

Alan Coopersmith alan.coopersmith at oracle.com
Sat Sep 24 08:48:22 PDT 2011


Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
---
 fd.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/fd.c b/fd.c
index 395bbbb..50c6f17 100644
--- a/fd.c
+++ b/fd.c
@@ -105,11 +105,10 @@ InitializeFD(void)
     }
 
   /* allocate space for a File Descriptor (FD) Table */
-  FDD = malloc (MaxFD * sizeof (struct FDDescriptor));
+  FDD = calloc (MaxFD, sizeof (struct FDDescriptor));
   if (FDD == NULL) {
       panic("Can't allocate memory for file descriptor table");
   }
-  bzero(FDD, (MaxFD * sizeof (struct FDDescriptor)));
 
   /* be sure all fd's are closed and marked not busy */
   for (i = 0; i < MaxFD; i++)
-- 
1.7.3.2



More information about the xorg-devel mailing list