Changes by: szaka
Update of /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25976/ntfsprogs
Modified Files:
ntfsinfo.c
Log Message:
cleanup get_index_root() named attribute usage
Index: ntfsinfo.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/ntfsinfo.c,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -p -r1.111 -r1.112
--- ntfsinfo.c 27 Mar 2006 20:14:22 -0000 1.111
+++ ntfsinfo.c 27 Mar 2006 20:27:38 -0000 1.112
@@ -1559,29 +1559,20 @@ static void ntfs_dump_attr_index_root(AT
static int get_index_root(ntfs_inode *ni, ATTR_RECORD *attr, INDEX_ROOT *iroot)
{
ntfs_attr_search_ctx *ctx;
- ntfschar *name = 0;
+ ntfschar *name;
INDEX_ROOT *root;
- if (attr->name_length) {
- name = malloc(attr->name_length * sizeof(ntfschar));
- if (!name) {
- ntfs_log_perror("malloc failed");
- return -1;
- }
- memcpy(name, (u8 *)attr + attr->name_offset,
- attr->name_length * sizeof(ntfschar));
- }
+ name = (ntfschar *)((u8 *)attr + le16_to_cpu(attr->name_offset));
+
ctx = ntfs_attr_get_search_ctx(ni, NULL);
if (!ctx) {
ntfs_log_perror("ntfs_get_search_ctx failed");
- free(name);
return -1;
}
if (ntfs_attr_lookup(AT_INDEX_ROOT, name, attr->name_length, 0,
0, NULL, 0, ctx)) {
ntfs_log_perror("ntfs_attr_lookup failed");
ntfs_attr_put_search_ctx(ctx);
- free(name);
return -1;
}
@@ -1589,7 +1580,6 @@ static int get_index_root(ntfs_inode *ni
le16_to_cpu(ctx->attr->value_offset));
*iroot = *root;
ntfs_attr_put_search_ctx(ctx);
- free(name);
return 0;
}
|