Fixed coverity issues

This commit is contained in:
Martin 2013-11-02 22:59:27 +01:00
parent 21fa82fc35
commit 2628a6a3a6
8 changed files with 15 additions and 4 deletions

View File

@ -82,6 +82,7 @@ void CLoadbalancerClient::operator ()(void)
if( err==-1 )
{
Server->Log("Could not connect to LoadBalancer", LL_ERROR );
closesocket(s);
return;
}

View File

@ -918,6 +918,7 @@ void CServer::StartCustomStreamService(IService *pService, std::string pServiceN
IPipe* CServer::ConnectStream(std::string pServer, unsigned short pPort, unsigned int pTimeoutms)
{
sockaddr_in server;
memset(&server, 0, sizeof(server));
LookupBlocking(pServer, &server.sin_addr);
server.sin_port=htons(pPort);
server.sin_family=AF_INET;
@ -1176,7 +1177,7 @@ void thread_helper_f(IThread *t)
}
#else
#ifndef _WIN32
void *thread_helper_f(void * t)
void thread_helper_f(void * t)
{
IThread *tmp=(IThread*)t;
(*tmp)();

View File

@ -61,4 +61,5 @@ void CServer::UnloadDLLs2(void)
int CServer::WriteDump(void* pExceptionPointers)
{
return 0;
}

View File

@ -66,7 +66,7 @@ bool DownloadfileThreaded(std::string url,std::string filename, IPipe *pipe, std
int Cs;
string ret;
sockaddr_in addr;
fstream out;
out.open(filename.c_str(),ios::out|ios::binary);
if(out.is_open()==false)
@ -115,6 +115,9 @@ bool DownloadfileThreaded(std::string url,std::string filename, IPipe *pipe, std
wd.addUChar(DL2_INFO_RESOLVING);
pipe->Write(wd.getDataPtr(), wd.getDataSize());
}
sockaddr_in addr;
memset(&addr, 0, sizeof(addr));
addr.sin_family=AF_INET;
if(proxy=="")

View File

@ -51,7 +51,7 @@ File::File()
bool File::Open(std::wstring pfn, int mode)
{
fn=pfn;
int flags;
int flags=0;
mode_t imode=S_IRWXU|S_IRWXG;
if( mode==MODE_READ || mode==MODE_READ_DEVICE || mode==MODE_READ_SEQUENTIAL || mode==MODE_READ_SEQUENTIAL_BACKUP)
{

View File

@ -125,7 +125,7 @@ void CHTTPProxy::operator()(void)
{
const char *vv="HTTP/1.0 200 OK\r\nContent-Type: video/mpeg\r\n\r\n";
size_t vv_len=strlen(vv);
char *msg=new char[vv_len];
char *msg=new char[vv_len+1];
memcpy(msg, vv, vv_len);
CBuffer b(msg, vv_len);
b.rcount=new int;

View File

@ -269,6 +269,7 @@ unsigned char *MD5::raw_digest(){
if (!finalized){
cerr << "MD5::raw_digest: Can't get digest if you haven't "<<
"finalized the digest!" <<endl;
delete []s;
return ( (unsigned char*) "");
}
@ -297,6 +298,7 @@ char *MD5::hex_digest(){
if (!finalized){
cerr << "MD5::hex_digest: Can't get digest if you haven't "<<
"finalized the digest!" <<endl;
delete []s;
char *bla=new char[1];
bla[0]=0;
return bla;

View File

@ -945,12 +945,14 @@ SBackup BackupServerGet::getLastIncremental(void)
b.complete=res[0][L"path"];
}
b.incremental_ref=0;
return b;
}
else
{
SBackup b;
b.incremental=-2;
b.incremental_ref=0;
return b;
}
}
@ -973,6 +975,7 @@ SBackup BackupServerGet::getLastIncrementalImage(const std::string &letter)
{
SBackup b;
b.incremental=-2;
b.incremental_ref=0;
return b;
}
}