More scrubbing
authorEric Andersen <andersen@codepoet.org>
Mon, 19 Nov 2001 10:59:37 +0000 (10:59 -0000)
committerEric Andersen <andersen@codepoet.org>
Mon, 19 Nov 2001 10:59:37 +0000 (10:59 -0000)
findutils/grep.c

index b98b724ac8ca718b33ffc4f9a627e413fc6dd9d8..7c1e0f60d06f7d9196807a5c7a1a641e72f1f9fd 100644 (file)
@@ -223,9 +223,10 @@ static void destroy_regexes()
 
        /* destroy all the elments in the array */
        while (--nregexes >= 0) {
-               regfree(&regexes[nregexes]);
+               regfree(regexes[nregexes]);
        }
-       free(regexes);
+       if (regexes)
+           free(regexes);
 }
 #endif
 
@@ -239,8 +240,7 @@ extern int grep_main(int argc, char **argv)
 
 #ifdef CONFIG_FEATURE_CLEAN_UP
        /* destroy command strings on exit */
-       if (atexit(destroy_regexes) == -1)
-               perror_msg_and_die("atexit");
+       atexit(destroy_regexes);
 #endif
 
 #ifdef CONFIG_FEATURE_GREP_EGREP_ALIAS