Merge pull request #2393 from ilya-lavrenov:coverity

This commit is contained in:
Roman Donchenko
2014-02-26 12:16:35 +04:00
committed by OpenCV Buildbot
37 changed files with 95 additions and 55 deletions

View File

@@ -237,6 +237,11 @@ CommandLineParser::CommandLineParser(int argc, const char* const argv[], const S
impl->sort_params();
}
CommandLineParser::~CommandLineParser()
{
if (CV_XADD(&impl->refcount, -1) == 1)
delete impl;
}
CommandLineParser::CommandLineParser(const CommandLineParser& parser)
{

View File

@@ -353,7 +353,7 @@ Mat& Mat::operator = (const Scalar& s)
Mat& Mat::setTo(InputArray _value, InputArray _mask)
{
if( !data )
if( empty() )
return *this;
Mat value = _value.getMat(), mask = _mask.getMat();
@@ -632,6 +632,7 @@ int cv::borderInterpolate( int p, int len, int borderType )
}
else if( borderType == BORDER_WRAP )
{
CV_Assert(len > 0);
if( p < 0 )
p -= ((p-len+1)/len)*len;
if( p >= len )

View File

@@ -2641,9 +2641,9 @@ KernelArg KernelArg::Constant(const Mat& m)
struct Kernel::Impl
{
Impl(const char* kname, const Program& prog)
Impl(const char* kname, const Program& prog) :
refcount(1), e(0), nu(0)
{
e = 0; refcount = 1;
cl_program ph = (cl_program)prog.ptr();
cl_int retval = 0;
handle = ph != 0 ?

View File

@@ -426,6 +426,7 @@ String format( const char* fmt, ... )
String s(len, '\0');
va_start(va, fmt);
len = vsnprintf((char*)s.c_str(), len + 1, fmt, va);
(void)len;
va_end(va);
return s;
}