Skip to content

Commit

Permalink
[XrdCl] various memory releated fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal committed Dec 11, 2017
1 parent 2752b60 commit a7e4e16
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/XrdCl/XrdClAsyncSocketHandler.cc
Expand Up @@ -543,7 +543,7 @@ namespace XrdCl
//----------------------------------------------------------------------
// Actual socket error error!
//----------------------------------------------------------------------
sign->SetCursor( 0 );
if( sign ) sign->SetCursor( 0 );
toWrite->SetCursor( 0 );
return Status( stError, errSocketError, errno );
}
Expand Down
6 changes: 5 additions & 1 deletion src/XrdCl/XrdClCopy.cc
Expand Up @@ -432,6 +432,8 @@ XrdCl::XRootDStatus GetDirList( XrdCl::FileSystem *fs,
}
}

delete list;

return XRootDStatus();
}

Expand Down Expand Up @@ -467,7 +469,7 @@ XrdCpFile *IndexRemote( XrdCl::FileSystem *fs,
current = new XrdCpFile( path.c_str(), badUrl );
if( badUrl )
{
// TODO release the memory !!!
// TODO release memory
log->Error( AppMsg, "Bad URL: %s", current->Path );
return 0;
}
Expand All @@ -477,6 +479,8 @@ XrdCpFile *IndexRemote( XrdCl::FileSystem *fs,
end = current;
}

delete dirList;

return start.Next;
}

Expand Down
1 change: 0 additions & 1 deletion src/XrdCl/XrdClFileStateHandler.hh
Expand Up @@ -455,7 +455,6 @@ namespace XrdCl
bool pDoRecoverRead;
bool pDoRecoverWrite;
bool pFollowRedirects;
bool pDoneInitOpen;
bool pUseVirtRedirector;

//------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/XrdCl/XrdClXCpSrc.cc
Expand Up @@ -64,7 +64,7 @@ class ChunkHandler: public ResponseHandler
*status = XRootDStatus( stError, errInternal );
}

if( chunk->length != pSize && status->IsOK() ) // the file size on the server is different
if( status->IsOK() && chunk->length != pSize ) // the file size on the server is different
{ // than the one specified in metalink file
*status = XRootDStatus( stError, errDataError );
}
Expand Down
14 changes: 9 additions & 5 deletions src/XrdCl/XrdClZipArchiveReader.cc
Expand Up @@ -664,11 +664,15 @@ XRootDStatus ZipArchiveReaderImpl::Read( const std::string &filename, uint64_t r
}

memcpy( buffer, pBuffer + offset, size );
XRootDStatus *st = new XRootDStatus();
AnyObject *resp = new AnyObject();
ChunkInfo *info = new ChunkInfo( relativeOffset, size, buffer );
resp->Set( info );
if( userHandler ) userHandler->HandleResponse( st, resp );

if( userHandler )
{
XRootDStatus *st = new XRootDStatus();
AnyObject *resp = new AnyObject();
ChunkInfo *info = new ChunkInfo( relativeOffset, size, buffer );
resp->Set( info );
userHandler->HandleResponse( st, resp );
}
return XRootDStatus();
}

Expand Down

0 comments on commit a7e4e16

Please sign in to comment.