mirror of
https://github.com/samba-team/samba.git
synced 2025-11-25 00:23:52 +03:00
r9126: Fix valgrind bug Volker found in interaction with new aio buffer
flipping and oplocks. Jeremy.
This commit is contained in:
committed by
Gerald (Jerry) Carter
parent
e9427912a7
commit
a18c5ff3ea
@@ -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) {
|
if((outbuf = NewOutBuffer(&saved_outbuf))==NULL) {
|
||||||
DEBUG(0,("oplock_break: malloc fail for output buffer.\n"));
|
DEBUG(0,("oplock_break: malloc fail for output buffer.\n"));
|
||||||
set_InBuffer(saved_inbuf);
|
/* Free must be done before set.. */
|
||||||
free_InBuffer(inbuf);
|
free_InBuffer(inbuf);
|
||||||
|
set_InBuffer(saved_inbuf);
|
||||||
return False;
|
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. */
|
/* Restore the chain fnum. */
|
||||||
file_chain_restore();
|
file_chain_restore();
|
||||||
|
|
||||||
|
/* 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. */
|
/* Restore the global In/Out buffers. */
|
||||||
set_InBuffer(saved_inbuf);
|
set_InBuffer(saved_inbuf);
|
||||||
set_OutBuffer(saved_outbuf);
|
set_OutBuffer(saved_outbuf);
|
||||||
|
|
||||||
/* Free the buffers we've been using to recurse. */
|
|
||||||
free_InBuffer(inbuf);
|
|
||||||
free_OutBuffer(outbuf);
|
|
||||||
|
|
||||||
/* We need this in case a readraw crossed on the wire. */
|
/* We need this in case a readraw crossed on the wire. */
|
||||||
if(global_oplock_break)
|
if(global_oplock_break)
|
||||||
global_oplock_break = False;
|
global_oplock_break = False;
|
||||||
|
|||||||
@@ -1527,6 +1527,7 @@ char *get_InBuffer(void)
|
|||||||
void set_InBuffer(char *new_inbuf)
|
void set_InBuffer(char *new_inbuf)
|
||||||
{
|
{
|
||||||
InBuffer = new_inbuf;
|
InBuffer = new_inbuf;
|
||||||
|
current_inbuf = InBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *get_OutBuffer(void)
|
char *get_OutBuffer(void)
|
||||||
@@ -1547,6 +1548,9 @@ void set_OutBuffer(char *new_outbuf)
|
|||||||
void free_InBuffer(char *inbuf)
|
void free_InBuffer(char *inbuf)
|
||||||
{
|
{
|
||||||
if (!aio_inbuffer_in_use(inbuf)) {
|
if (!aio_inbuffer_in_use(inbuf)) {
|
||||||
|
if (current_inbuf == inbuf) {
|
||||||
|
current_inbuf = NULL;
|
||||||
|
}
|
||||||
SAFE_FREE(inbuf);
|
SAFE_FREE(inbuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user