summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@samba.org>2019-02-18 17:41:08 +0100
committerGünther Deschner <gd@samba.org>2019-02-20 12:11:20 +0100
commit9c2d15c254b6b3f7c46d72c7fe22a402ef110a64 (patch)
tree606df6651ba815e17d7058dbc714095825cae704 /source3
parentd4baed454fb45466f29a19518991be5200a08bde (diff)
downloadsamba-9c2d15c254b6b3f7c46d72c7fe22a402ef110a64.tar.gz
vfs_glusterfs: check for VFS_ADD_FSP_EXTENSION() failure
Signed-off-by: David Disseldorp <ddiss@samba.org> Reviewed-by: Guenther Deschner <gd@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/modules/vfs_glusterfs.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 601be5a2da4..82a7c2ce9b4 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -592,6 +592,12 @@ static int vfs_gluster_open(struct vfs_handle_struct *handle,
glfs_fd_t *glfd;
glfs_fd_t **p_tmp;
+ p_tmp = VFS_ADD_FSP_EXTENSION(handle, fsp, glfs_fd_t *, NULL);
+ if (p_tmp == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+
if (flags & O_DIRECTORY) {
glfd = glfs_opendir(handle->data, smb_fname->base_name);
} else if (flags & O_CREAT) {
@@ -602,9 +608,11 @@ static int vfs_gluster_open(struct vfs_handle_struct *handle,
}
if (glfd == NULL) {
+ /* no extension destroy_fn, so no need to save errno */
+ VFS_REMOVE_FSP_EXTENSION(handle, fsp);
return -1;
}
- p_tmp = VFS_ADD_FSP_EXTENSION(handle, fsp, glfs_fd_t *, NULL);
+
*p_tmp = glfd;
/* An arbitrary value for error reporting, so you know its us. */
return 13371337;