Tutorial code fix
Accessed elements of names[] after freeing them in the first example. Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
a470579ba2
commit
1e746fd89a
|
@ -471,8 +471,6 @@ main ()
|
||||||
diff = end - start;
|
diff = end - start;
|
||||||
|
|
||||||
/* free var */
|
/* free var */
|
||||||
for (i = 0; i < count; ++i)
|
|
||||||
free (names[i]);
|
|
||||||
free (atoms);
|
free (atoms);
|
||||||
free (cs);
|
free (cs);
|
||||||
|
|
||||||
|
@ -494,6 +492,8 @@ main ()
|
||||||
printf ("ratio : %f\n", diff_x / diff);
|
printf ("ratio : %f\n", diff_x / diff);
|
||||||
|
|
||||||
free (atoms_x);
|
free (atoms_x);
|
||||||
|
for (i = 0; i < count; ++i)
|
||||||
|
free (names[i]);
|
||||||
free (names);
|
free (names);
|
||||||
|
|
||||||
XCloseDisplay (disp);
|
XCloseDisplay (disp);
|
||||||
|
|
Loading…
Reference in New Issue