summaryrefslogtreecommitdiff
path: root/source3/smbd/oplock.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-08-05 17:10:10 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:00:26 -0500
commit3dae794632f48ae163d1195fef19c14e67f341cc (patch)
tree6529995a75fb6370eadb634b8d11aec3686a4b86 /source3/smbd/oplock.c
parent30865196bf08fa7a8cda8e7305b911067fb84fab (diff)
downloadsamba-3dae794632f48ae163d1195fef19c14e67f341cc.tar.gz
samba-3dae794632f48ae163d1195fef19c14e67f341cc.tar.bz2
samba-3dae794632f48ae163d1195fef19c14e67f341cc.zip
r9126: Fix valgrind bug Volker found in interaction with new aio buffer
flipping and oplocks. Jeremy. (This used to be commit a18c5ff3eada93e46da3f7cbd326b8dceb72e147)
Diffstat (limited to 'source3/smbd/oplock.c')
-rw-r--r--source3/smbd/oplock.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index de12003986..c0c9e989a9 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -757,8 +757,9 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, unsigned long file_id,
if((outbuf = NewOutBuffer(&saved_outbuf))==NULL) {
DEBUG(0,("oplock_break: malloc fail for output buffer.\n"));
- set_InBuffer(saved_inbuf);
+ /* Free must be done before set.. */
free_InBuffer(inbuf);
+ set_InBuffer(saved_inbuf);
return False;
}
@@ -918,14 +919,15 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, unsigned long file_id,
/* Restore the chain fnum. */
file_chain_restore();
- /* Restore the global In/Out buffers. */
- set_InBuffer(saved_inbuf);
- set_OutBuffer(saved_outbuf);
-
/* Free the buffers we've been using to recurse. */
+ /* Free must be done before set.. */
free_InBuffer(inbuf);
free_OutBuffer(outbuf);
+ /* Restore the global In/Out buffers. */
+ set_InBuffer(saved_inbuf);
+ set_OutBuffer(saved_outbuf);
+
/* We need this in case a readraw crossed on the wire. */
if(global_oplock_break)
global_oplock_break = False;