Cleanups and memleak fix to error code paths of ntfs_create.

edge.strict_endians
cha0smaster 2005-08-22 21:33:07 +00:00
parent c7eaee5a0f
commit 6f8cd6e5ef
5 changed files with 9 additions and 6 deletions

View File

@ -52,8 +52,8 @@ extern void ntfs_name_upcase(ntfschar *name, u32 name_len,
extern void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr,
const ntfschar *upcase, const u32 upcase_len);
extern int ntfs_file_values_compare(FILE_NAME_ATTR *file_name_attr1,
FILE_NAME_ATTR *file_name_attr2,
extern int ntfs_file_values_compare(const FILE_NAME_ATTR *file_name_attr1,
const FILE_NAME_ATTR *file_name_attr2,
const int err_val, const IGNORE_CASE_BOOL ic,
const ntfschar *upcase, const u32 upcase_len);

View File

@ -34,7 +34,7 @@
#include "unistr.h"
/**
* ntfs_attrlist_need - check whether attribute need attribute list
* ntfs_attrlist_need - check whether inode need attribute list
* @ni: opened ntfs inode for which perform check
*
* Check whether all are attributes belong to one MFT record, in that case

View File

@ -1118,6 +1118,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len,
}
if (ntfs_attr_pwrite(na, 0, si_len, si) != si_len) {
err = errno;
ntfs_attr_close(na);
ntfs_error(, "Failed to initialize STANDARD_INFORMATION "
"attribute.");
goto err_out;
@ -1165,6 +1166,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len,
if (ntfs_attr_pwrite(na, 0, ir_len, ir) != ir_len) {
err = errno;
free(ir);
ntfs_attr_close(na);
ntfs_error(, "Failed to initialize INDEX_ROOT.");
goto err_out;
}
@ -1207,6 +1209,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, ntfschar *name, u8 name_len,
}
if (ntfs_attr_pwrite(na, 0, fn_len, fn) != fn_len) {
err = errno;
ntfs_attr_close(na);
ntfs_error(, "Failed to initialize FILE_NAME attribute.");
goto err_out;
}

View File

@ -314,8 +314,8 @@ void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr,
/**
* ntfs_file_values_compare
*/
int ntfs_file_values_compare(FILE_NAME_ATTR *file_name_attr1,
FILE_NAME_ATTR *file_name_attr2,
int ntfs_file_values_compare(const FILE_NAME_ATTR *file_name_attr1,
const FILE_NAME_ATTR *file_name_attr2,
const int err_val, const IGNORE_CASE_BOOL ic,
const ntfschar *upcase, const u32 upcase_len)
{

View File

@ -632,7 +632,7 @@ static int ntfs_fuse_rm(const char *org_path)
if (!path)
return -errno;
/* Open object for delete. */
ni = ntfs_pathname_to_inode(ctx->vol, NULL, path);
ni = ntfs_pathname_to_inode(ctx->vol, NULL, path);
if (!ni) {
res = -errno;
goto exit;