tree.c
changeset 48 b94d657a9acb
parent 47 63adb261de90
child 61 4b4c97f179da
--- a/tree.c
+++ b/tree.c
@@ -38,9 +38,11 @@
         if ((t->next = malloc (sizeof (T))) == NULL)
             break;
         t->next->data = GETRANDOM (rand_max);
-        t->next->next = NULL;
         t = t->next;
     }
+
+    t->next = NULL;
+
     return first;
 }
 
@@ -50,7 +52,7 @@
 
     if (argc != 3) {
         printf ("Usage: %s elements rand_max\n", argv[0]);
-        return EXIT_SUCCESS;
+        return EXIT_FAILURE;
     }
 
     t = make_list (atoi (argv[1]), atoi (argv[2]));