No need to allocate a copy of the attribute name to be passed to
ntfs_attr_open(). (Logical change 1.576)edge.strict_endians
parent
da83a15a1c
commit
e461268d28
|
|
@ -1178,59 +1178,40 @@ static void ntfs_dump_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni)
|
||||||
|
|
||||||
get_type_and_size_of_indx(ni, attr, &type, &indx_record_size);
|
get_type_and_size_of_indx(ni, attr, &type, &indx_record_size);
|
||||||
|
|
||||||
name = malloc(attr->name_length * sizeof(ntfschar));
|
name = (ntfschar*)((u8*)attr + attr->name_offset);
|
||||||
if (!name) {
|
|
||||||
perror("malloc failed");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
memcpy(name, (u8 *)attr + attr->name_offset,
|
|
||||||
attr->name_length * sizeof(ntfschar));
|
|
||||||
na = ntfs_attr_open(ni, AT_BITMAP, name, attr->name_length);
|
na = ntfs_attr_open(ni, AT_BITMAP, name, attr->name_length);
|
||||||
if (!na) {
|
if (!na) {
|
||||||
perror("ntfs_attr_open failed");
|
perror("ntfs_attr_open failed");
|
||||||
free(name);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
bitmap = malloc(na->data_size);
|
bitmap = malloc(na->data_size);
|
||||||
if (!bitmap) {
|
if (!bitmap) {
|
||||||
perror("malloc failed");
|
perror("malloc failed");
|
||||||
free(name);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ntfs_attr_pread(na, 0, na->data_size, bitmap) != na->data_size) {
|
if (ntfs_attr_pread(na, 0, na->data_size, bitmap) != na->data_size) {
|
||||||
perror("ntfs_attr_pread failed");
|
perror("ntfs_attr_pread failed");
|
||||||
free(bitmap);
|
free(bitmap);
|
||||||
free(name);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
ntfs_attr_close(na);
|
ntfs_attr_close(na);
|
||||||
byte = bitmap;
|
byte = bitmap;
|
||||||
|
|
||||||
name = malloc(attr->name_length * sizeof(ntfschar));
|
|
||||||
if (!name) {
|
|
||||||
perror("malloc failed");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
memcpy(name, (u8 *)attr + attr->name_offset,
|
|
||||||
attr->name_length * sizeof(ntfschar));
|
|
||||||
na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, name, attr->name_length);
|
na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, name, attr->name_length);
|
||||||
if (!na) {
|
if (!na) {
|
||||||
perror("ntfs_attr_open failed");
|
perror("ntfs_attr_open failed");
|
||||||
free(name);
|
|
||||||
free(bitmap);
|
free(bitmap);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
allocation = malloc(na->data_size);
|
allocation = malloc(na->data_size);
|
||||||
if (!allocation) {
|
if (!allocation) {
|
||||||
perror("malloc failed");
|
perror("malloc failed");
|
||||||
free(name);
|
|
||||||
free(bitmap);
|
free(bitmap);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (ntfs_attr_pread(na, 0, na->data_size, allocation)
|
if (ntfs_attr_pread(na, 0, na->data_size, allocation)
|
||||||
!= na->data_size) {
|
!= na->data_size) {
|
||||||
perror("ntfs_attr_pread failed");
|
perror("ntfs_attr_pread failed");
|
||||||
free(name);
|
|
||||||
free(allocation);
|
free(allocation);
|
||||||
free(bitmap);
|
free(bitmap);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue