diff -r dcb29ce4485f ls.c --- a/ls.c Tue Nov 08 19:35:38 2011 +0100 +++ b/ls.c Fri Dec 23 02:34:01 2011 +0400 @@ -62,7 +62,7 @@ many = (argc > optind+1); if((n = argc - optind) > 0) { - if(!(ents = malloc((argc-1) * sizeof *ents))) + if(!(ents = malloc(n * sizeof *ents))) eprintf("malloc:"); for(i = 0; i < n; i++) mkent(&ents[i], argv[optind+i]);