]> granicus.if.org Git - fortune-mod/blobdiff - fortune-mod/fortune/fortune.c
Fix a memleak when using the "-f" flag.
[fortune-mod] / fortune-mod / fortune / fortune.c
index 98729177b0596eb6adcc5e276bab959fdc338d2b..3ec1a917f6621effc1c9270a0600a109e754a805 100644 (file)
@@ -1742,24 +1742,25 @@ int main(int ac, char *av[])
         if (Equal_probs)
             calc_equal_probs();
         print_list(File_list, 0);
-        exit(0);
     }
-    srandom((unsigned int) (time((time_t *) NULL) + getpid()));
-    do
+    else
     {
-        get_fort();
-    }
-    while ((Short_only && fortlen() > SLEN) ||
-           (Long_only && fortlen() <= SLEN));
+        srandom((unsigned int) (time((time_t *) NULL) + getpid()));
+        do
+        {
+            get_fort();
+        }
+        while ((Short_only && fortlen() > SLEN) ||
+            (Long_only && fortlen() <= SLEN));
 
-    display(Fortfile);
+        display(Fortfile);
 
-    if (Wait)
-    {
-        fortlen();
-        sleep((unsigned int) max(Fort_len / CPERS, MINW));
+        if (Wait)
+        {
+            fortlen();
+            sleep((unsigned int) max(Fort_len / CPERS, MINW));
+        }
     }
-
     recode_delete_request(request);
     recode_delete_outer(outer);