ntfs: fixed coverity resource leaks.
* CID 5723, 5724, 5725, 5726, 5728, 5736, 5737
This commit is contained in:
parent
3e0b63a489
commit
05326911fc
@ -271,7 +271,8 @@ fs_mount(fs_volume *_vol, const char *device, ulong flags, const char *args,
|
||||
ntfs_calc_free_space(ns);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
free(ns);
|
||||
|
||||
exit:
|
||||
ERROR("fs_mount - EXIT, result code is %s\n", strerror(result));
|
||||
@ -978,6 +979,7 @@ exit:
|
||||
ntfs_inode_close(ni);
|
||||
if (bi)
|
||||
ntfs_inode_close(bi);
|
||||
free(uname);
|
||||
|
||||
TRACE("fs_create - EXIT, result is %s\n", strerror(result));
|
||||
|
||||
@ -1384,6 +1386,8 @@ exit:
|
||||
ntfs_inode_close(sym);
|
||||
if (bi)
|
||||
ntfs_inode_close(bi);
|
||||
free(utarget);
|
||||
free(uname);
|
||||
|
||||
TRACE("fs_symlink - EXIT, result is %s\n", strerror(result));
|
||||
|
||||
@ -1444,7 +1448,6 @@ fs_mkdir(fs_volume *_vol, fs_vnode *_dir, const char *name, int perms)
|
||||
newNode = (vnode*)ntfs_calloc(sizeof(vnode));
|
||||
if (newNode == NULL) {
|
||||
result = ENOMEM;
|
||||
ntfs_inode_close(ni);
|
||||
goto exit;
|
||||
}
|
||||
|
||||
@ -1469,6 +1472,7 @@ exit:
|
||||
ntfs_inode_close(ni);
|
||||
if (bi)
|
||||
ntfs_inode_close(bi);
|
||||
free(uname);
|
||||
|
||||
TRACE("fs_mkdir - EXIT, result is %s\n", strerror(result));
|
||||
|
||||
|
@ -92,7 +92,7 @@ fs_opendir(fs_volume *_vol, fs_vnode *_node, void** _cookie)
|
||||
{
|
||||
nspace *ns = (nspace*)_vol->private_volume;
|
||||
vnode *node = (vnode*)_node->private_node;
|
||||
dircookie *cookie = (dircookie*)ntfs_calloc(sizeof(dircookie));
|
||||
dircookie *cookie = NULL;
|
||||
int result = B_NO_ERROR;
|
||||
ntfs_inode *ni = NULL;
|
||||
|
||||
@ -111,6 +111,7 @@ fs_opendir(fs_volume *_vol, fs_vnode *_node, void** _cookie)
|
||||
goto exit;
|
||||
}
|
||||
|
||||
cookie = (dircookie*)ntfs_calloc(sizeof(dircookie));
|
||||
if (cookie != NULL) {
|
||||
cookie->pos = 0;
|
||||
cookie->ino = 0;
|
||||
|
@ -578,7 +578,7 @@ int utils_attr_get_name(ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int b
|
||||
|
||||
attrdef = ntfs_attr_find_in_attrdef(vol, attr->type);
|
||||
if (attrdef) {
|
||||
name = NULL;
|
||||
name = NULL;
|
||||
namelen = ntfs_ucsnlen(attrdef->name, sizeof(attrdef->name));
|
||||
if (ntfs_ucstombs(attrdef->name, namelen, &name, 0) < 0) {
|
||||
ntfs_log_error("Couldn't translate attribute type to current locale.\n");
|
||||
@ -593,17 +593,20 @@ int utils_attr_get_name(ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int b
|
||||
|
||||
if (len >= bufsize) {
|
||||
ntfs_log_error("Attribute type was truncated.\n");
|
||||
free(name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!attr->name_length) {
|
||||
free(name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
buffer += len;
|
||||
bufsize -= len;
|
||||
|
||||
name = NULL;
|
||||
free(name);
|
||||
name = NULL;
|
||||
namelen = attr->name_length;
|
||||
if (ntfs_ucstombs((ntfschar *)((char *)attr + attr->name_offset),
|
||||
namelen, &name, 0) < 0) {
|
||||
|
@ -216,6 +216,7 @@ int ntfs_change_label(ntfs_volume *vol, char *label)
|
||||
}
|
||||
result = 0;
|
||||
err_out:
|
||||
ntfs_attr_put_search_ctx(ctx);
|
||||
free(new_label);
|
||||
return result;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user