X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fntfs-capture.c;h=da7944809c9c1817575634491e8881cb4a16d08c;hb=fa151ff40338619c7dbbdc06c227754b6b94c2e1;hp=7c04e9b85b2410797212fb2aad119acce296eea1;hpb=16176f3b7ce78da85646e814bd2f3ffe5babb82b;p=wimlib diff --git a/src/ntfs-capture.c b/src/ntfs-capture.c index 7c04e9b8..da794480 100644 --- a/src/ntfs-capture.c +++ b/src/ntfs-capture.c @@ -382,7 +382,7 @@ free_dos_name_tree(struct rb_node *node) { } } -static void +static void destroy_dos_name_map(struct dos_name_map *map) { free_dos_name_tree(map->rb_root.rb_node); @@ -403,8 +403,11 @@ struct readdir_ctx { }; static int -build_dentry_tree_ntfs_recursive(struct wim_dentry **root_p, ntfs_inode *dir_ni, - ntfs_inode *ni, char path[], size_t path_len, +build_dentry_tree_ntfs_recursive(struct wim_dentry **root_p, + ntfs_inode *dir_ni, + ntfs_inode *ni, + mbchar *path, + size_t path_len, int name_type, struct wim_lookup_table *lookup_table, struct sd_set *sd_set, @@ -421,7 +424,7 @@ wim_ntfs_capture_filldir(void *dirent, const ntfschar *name, { struct readdir_ctx *ctx; size_t mbs_name_nbytes; - char *mbs_name; + mbchar *mbs_name; struct wim_dentry *child; int ret; size_t path_len; @@ -436,12 +439,12 @@ wim_ntfs_capture_filldir(void *dirent, const ntfschar *name, /* Return now if an error occurred or if this is just a DOS name * and not a Win32+DOS name. */ if (ret != 0 || name_type == FILE_NAME_DOS) - return ret; + goto out; } ret = utf16le_to_mbs(name, name_nbytes, &mbs_name, &mbs_name_nbytes); - if (ret != 0) - return -1; + if (ret) + goto out; if (mbs_name[0] == '.' && (mbs_name[1] == '\0' || @@ -459,6 +462,7 @@ wim_ntfs_capture_filldir(void *dirent, const ntfschar *name, ntfs_inode *ni = ntfs_inode_open(ctx->dir_ni->vol, mref); if (!ni) { ERROR_WITH_ERRNO("Failed to open NTFS inode"); + ret = -1; goto out_free_mbs_name; } path_len = ctx->path_len; @@ -478,6 +482,7 @@ wim_ntfs_capture_filldir(void *dirent, const ntfschar *name, ntfs_inode_close(ni); out_free_mbs_name: FREE(mbs_name); +out: return ret; }