Tutorial code fix
authorJim Ingram <ingramj@gmail.com>
Mon, 7 Dec 2009 20:41:18 +0000 (14:41 -0600)
committerJulien Danjou <julien@danjou.info>
Tue, 8 Dec 2009 08:41:26 +0000 (09:41 +0100)
Accessed elements of names[] after freeing them in the first example.

Signed-off-by: Julien Danjou <julien@danjou.info>
doc/tutorial/index.html

index 5824807..aa3ae17 100644 (file)
@@ -471,8 +471,6 @@ main ()
   diff = end - start;
 
   /* free var */
-  for (i = 0; i &lt; count; ++i)
-    free (names[i]);
   free (atoms);
   free (cs);
 
@@ -494,6 +492,8 @@ main ()
   printf ("ratio         : %f\n", diff_x / diff);
 
   free (atoms_x);
+  for (i = 0; i &lt; count; ++i)
+    free (names[i]);
   free (names);
 
   XCloseDisplay (disp);