]> wimlib.net Git - wimlib/blobdiff - src/ntfs-3g_capture.c
Add memdup() function
[wimlib] / src / ntfs-3g_capture.c
index 256e249431e32405fc45eaf1ecb58b60e0b0b0cf..034bd1b0e3d897bbfc887dfb79fdff1a3a97900b 100644 (file)
@@ -220,21 +220,18 @@ capture_ntfs_streams(struct wim_inode *inode,
                                goto out_put_actx;
                        }
                        ntfs_loc->ntfs_vol = vol;
-                       ntfs_loc->path = MALLOC(path_len + 1);
+                       ntfs_loc->path = memdup(path, path_len + 1);
                        if (!ntfs_loc->path) {
                                ret = WIMLIB_ERR_NOMEM;
                                goto out_free_ntfs_loc;
                        }
-                       memcpy(ntfs_loc->path, path, path_len + 1);
                        if (name_length) {
-                               ntfs_loc->stream_name = MALLOC(name_length * 2);
+                               ntfs_loc->stream_name = memdup(attr_record_name(actx->attr),
+                                                              name_length * 2);
                                if (!ntfs_loc->stream_name) {
                                        ret = WIMLIB_ERR_NOMEM;
                                        goto out_free_ntfs_loc;
                                }
-                               memcpy(ntfs_loc->stream_name,
-                                      attr_record_name(actx->attr),
-                                      actx->attr->name_length * 2);
                                ntfs_loc->stream_name_nchars = name_length;
                        }
 
@@ -725,10 +722,10 @@ build_dentry_tree_ntfs(struct wim_dentry **root_p,
 
        DEBUG("Mounting NTFS volume `%s' read-only", device);
 
-#ifdef HAVE_NTFS_MNT_RDONLY
+#if defined(NTFS_MNT_RDONLY)
        /* NTFS-3g 2013 */
        vol = ntfs_mount(device, NTFS_MNT_RDONLY);
-#else
+#elif defined(MS_RDONLY)
        /* NTFS-3g 2011, 2012 */
        vol = ntfs_mount(device, MS_RDONLY);
 #endif