From: Stefan Metzmacher Date: Wed, 29 Aug 2018 02:24:46 +0000 (+0200) Subject: s3:vfs: fix valgrind warning in SMB_VFS_{PREAD,PWRITE,FSYNC}_RECV() X-Git-Tag: tdb-1.3.17~1868 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7356e814dfd3921e465a16cfe4b7998bc6f92dd1;p=thirdparty%2Fsamba.git s3:vfs: fix valgrind warning in SMB_VFS_{PREAD,PWRITE,FSYNC}_RECV() tevent_req_received() destroys 'state', so we need helper variables to hold the return value. Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme Autobuild-User(master): Stefan Metzmacher Autobuild-Date(master): Tue Sep 4 10:45:10 CEST 2018 on sn-devel-144 --- diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index 2687e3540b8..a6c49cfad34 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -2579,14 +2579,16 @@ ssize_t SMB_VFS_PREAD_RECV(struct tevent_req *req, { struct smb_vfs_call_pread_state *state = tevent_req_data( req, struct smb_vfs_call_pread_state); + ssize_t retval; if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) { tevent_req_received(req); return -1; } *vfs_aio_state = state->vfs_aio_state; + retval = state->retval; tevent_req_received(req); - return state->retval; + return retval; } ssize_t smb_vfs_call_pwrite(struct vfs_handle_struct *handle, @@ -2653,14 +2655,16 @@ ssize_t SMB_VFS_PWRITE_RECV(struct tevent_req *req, { struct smb_vfs_call_pwrite_state *state = tevent_req_data( req, struct smb_vfs_call_pwrite_state); + ssize_t retval; if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) { tevent_req_received(req); return -1; } *vfs_aio_state = state->vfs_aio_state; + retval = state->retval; tevent_req_received(req); - return state->retval; + return retval; } off_t smb_vfs_call_lseek(struct vfs_handle_struct *handle, @@ -2748,14 +2752,16 @@ int SMB_VFS_FSYNC_RECV(struct tevent_req *req, struct vfs_aio_state *vfs_aio_sta { struct smb_vfs_call_fsync_state *state = tevent_req_data( req, struct smb_vfs_call_fsync_state); + ssize_t retval; if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) { tevent_req_received(req); return -1; } *vfs_aio_state = state->vfs_aio_state; + retval = state->retval; tevent_req_received(req); - return state->retval; + return retval; } /*