diff: fix segfault on empty dirs (Peter Korsgaard <peter.korsgaard@barco.com>)
authorDenis Vlasenko <vda.linux@googlemail.com>
Thu, 5 Apr 2007 21:29:42 +0000 (21:29 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Thu, 5 Apr 2007 21:29:42 +0000 (21:29 -0000)
coreutils/diff.c

index 1903bb1511c99f94e9cce9a8ceaab3933a85a048..75557187c981b8b469ad316a7627a2da93d6892c 100644 (file)
@@ -1070,7 +1070,7 @@ static int add_to_dirlist(const char *filename,
 static char **get_dir(char *path)
 {
        dl_count = 0;
-       dl = NULL;
+       dl = xzalloc(sizeof(dl[0]));
 
        /* If -r has been set, then the recursive_action function will be
         * used. Unfortunately, this outputs the root directory along with