blob_table.c: fix NTFS location clone error path
authorEric Biggers <ebiggers3@gmail.com>
Tue, 24 Mar 2015 01:47:38 +0000 (20:47 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Thu, 26 Mar 2015 00:56:37 +0000 (19:56 -0500)
src/blob_table.c

index 5551c1635549af9451d0be01c466478da447c200..84835b5a7a03b6ca2d5a7774c55f98c025a2bad2 100644 (file)
@@ -149,19 +149,18 @@ clone_blob_descriptor(const struct blob_descriptor *old)
 #ifdef WITH_NTFS_3G
        case BLOB_IN_NTFS_VOLUME:
                if (old->ntfs_loc) {
-                       struct ntfs_location *loc;
-                       loc = memdup(old->ntfs_loc, sizeof(struct ntfs_location));
-                       if (loc == NULL)
+                       new->ntfs_loc = memdup(old->ntfs_loc,
+                                              sizeof(struct ntfs_location));
+                       if (new->ntfs_loc == NULL)
                                goto out_free;
-                       loc->path = NULL;
-                       loc->attr_name = NULL;
-                       new->ntfs_loc = loc;
-                       loc->path = STRDUP(old->ntfs_loc->path);
-                       if (loc->path == NULL)
+                       new->ntfs_loc->path = STRDUP(old->ntfs_loc->path);
+                       new->ntfs_loc->attr_name = NULL;
+                       if (new->ntfs_loc->path == NULL)
                                goto out_free;
-                       if (loc->attr_name_nchars != 0) {
-                               loc->attr_name = utf16le_dup(old->ntfs_loc->attr_name);
-                               if (loc->attr_name == NULL)
+                       if (new->ntfs_loc->attr_name_nchars != 0) {
+                               new->ntfs_loc->attr_name =
+                                       utf16le_dup(old->ntfs_loc->attr_name);
+                               if (new->ntfs_loc->attr_name == NULL)
                                        goto out_free;
                        }
                }