mksquashfs: Move strdupping of filename/subpath to scan1_opendir()

This simplifies the logic, eliminating the need to strdup on the
recursive call to dir_scan1(), and eliminating the need to free
them on recursive dir_scan1() failure.

Signed-off-by: Phillip Lougher <phillip@squashfs.org.uk>
diff --git a/squashfs-tools/mksquashfs.c b/squashfs-tools/mksquashfs.c
index 2aaaee9..07f18e2 100644
--- a/squashfs-tools/mksquashfs.c
+++ b/squashfs-tools/mksquashfs.c
@@ -3544,8 +3544,8 @@
 		free(dir);
 		return NULL;
 	}
-	dir->pathname = pathname;
-	dir->subpath = subpath;
+	dir->pathname = strdup(pathname);
+	dir->subpath = strdup(subpath);
 	dir->count = 0;
 	dir->directory_count = 0;
 	dir->dir_is_ldir = TRUE;
@@ -3727,14 +3727,10 @@
 		}
 
 		if((buf.st_mode & S_IFMT) == S_IFDIR) {
-			filename = strdup(filename);
-			subpath = strdup(subpath);
 			sub_dir = dir_scan1(filename, subpath, new,
 					scan1_readdir, depth + 1);
 			if(sub_dir == NULL) {
 				free_dir_entry(dir_ent);
-				free(filename);
-				free(subpath);
 				free(new);
 				continue;
 			}
@@ -5001,7 +4997,7 @@
 
 
 #define VERSION() \
-	printf("mksquashfs version 4.2-git (2013/01/07)\n");\
+	printf("mksquashfs version 4.2-git (2013/01/08)\n");\
 	printf("copyright (C) 2013 Phillip Lougher "\
 		"<phillip@squashfs.org.uk>\n\n"); \
 	printf("This program is free software; you can redistribute it and/or"\