mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-06 00:30:40 +00:00
Remove some extraneous null pointer checks (fixes #234)
There were a few places in the code that were checking that a pointer wasn't null before deleting it, even though C++ has always allowed delete 0. Most of the code did not perform these checks.
This commit is contained in:
parent
4a4736c695
commit
b6e414b10b
@ -11,10 +11,7 @@ ClosedFileInputSource::Members::Members(char const* filename) :
|
|||||||
|
|
||||||
ClosedFileInputSource::Members::~Members()
|
ClosedFileInputSource::Members::~Members()
|
||||||
{
|
{
|
||||||
if (fis)
|
delete fis;
|
||||||
{
|
|
||||||
delete fis;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClosedFileInputSource::ClosedFileInputSource(char const* filename) :
|
ClosedFileInputSource::ClosedFileInputSource(char const* filename) :
|
||||||
|
@ -31,11 +31,8 @@ Pl_Flate::Pl_Flate(char const* identifier, Pipeline* next,
|
|||||||
|
|
||||||
Pl_Flate::~Pl_Flate()
|
Pl_Flate::~Pl_Flate()
|
||||||
{
|
{
|
||||||
if (this->outbuf)
|
delete [] this->outbuf;
|
||||||
{
|
this->outbuf = 0;
|
||||||
delete [] this->outbuf;
|
|
||||||
this->outbuf = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->initialized)
|
if (this->initialized)
|
||||||
{
|
{
|
||||||
|
@ -13,11 +13,8 @@ Pl_RC4::Pl_RC4(char const* identifier, Pipeline* next,
|
|||||||
|
|
||||||
Pl_RC4::~Pl_RC4()
|
Pl_RC4::~Pl_RC4()
|
||||||
{
|
{
|
||||||
if (this->outbuf)
|
delete [] this->outbuf;
|
||||||
{
|
this->outbuf = 0;
|
||||||
delete [] this->outbuf;
|
|
||||||
this->outbuf = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -47,10 +44,7 @@ Pl_RC4::write(unsigned char* data, size_t len)
|
|||||||
void
|
void
|
||||||
Pl_RC4::finish()
|
Pl_RC4::finish()
|
||||||
{
|
{
|
||||||
if (this->outbuf)
|
delete [] this->outbuf;
|
||||||
{
|
this->outbuf = 0;
|
||||||
delete [] this->outbuf;
|
|
||||||
this->outbuf = 0;
|
|
||||||
}
|
|
||||||
this->getNext()->finish();
|
this->getNext()->finish();
|
||||||
}
|
}
|
||||||
|
@ -75,10 +75,7 @@ QPDFWriter::Members::~Members()
|
|||||||
{
|
{
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
if (output_buffer)
|
delete output_buffer;
|
||||||
{
|
|
||||||
delete output_buffer;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QPDFWriter::QPDFWriter(QPDF& pdf) :
|
QPDFWriter::QPDFWriter(QPDF& pdf) :
|
||||||
|
Loading…
Reference in New Issue
Block a user