[Xcb-commit] tutorial.mdwn

XCB site xcb at freedesktop.org
Sun Jun 13 13:56:54 PDT 2010


 tutorial.mdwn |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 83dc3b4c77e0f4de9a98b32930bb451610d02f7e
Author: eremin <eremin at web>
Date:   Sun Jun 13 13:56:53 2010 -0700

    malloc(NUM_NAMES): allocates just N bytes instead of N pointers and causes glibc backtrace or segfault

diff --git a/tutorial.mdwn b/tutorial.mdwn
index 918e608..e2beea9 100644
--- a/tutorial.mdwn
+++ b/tutorial.mdwn
@@ -212,7 +212,7 @@ To further compare Xlib to XCB, there's a XInternAtoms routine.  It's the Xlib m
     int
     main () {
     	/* setup names for tests */
-    	char (**names) = malloc(NUM_NAMES);
+    	char (**names) = malloc(NUM_NAMES*sizeof(*names));
     	// init names to "NAME0", "NAME1", "NAME2" ... and so on
     	for (int i = 0; i < NUM_NAMES; ++i) {
     		char buf[100];


More information about the xcb-commit mailing list