Blob Blame History Raw
Index: src/xend_internal.c
===================================================================
RCS file: /data/cvs/libxen/src/xend_internal.c,v
retrieving revision 1.251
diff -u -r1.251 xend_internal.c
--- src/xend_internal.c	13 Feb 2009 18:23:23 -0000	1.251
+++ src/xend_internal.c	10 Mar 2009 10:00:28 -0000
@@ -904,7 +904,15 @@
         count++;
     }
 
-    if (VIR_ALLOC_N(ptr, count + 1 + extra) < 0)
+    /*
+     * We can'tuse the normal allocation routines as we are mixing
+     * an array of char * at the beginning followed by an array of char
+     * ret points to the NULL terminated array of char *
+     * ptr points to the current string after that array but in the same
+     * allocated block
+     */
+    if (virAlloc((void *)&ptr,
+                 (count + 1) * sizeof(char *) + extra * sizeof(char)) < 0)
         goto error;
 
     ret = (char **) ptr;