Moved the if (!buffer) check to infront of the memory initialization

This commit is contained in:
Robert Osfield 2008-07-21 16:17:41 +00:00
parent dc19bcc7e0
commit 2125c9843b

View File

@ -499,7 +499,6 @@ simage_tiff_load(std::istream& fin,
osg::notify(osg::INFO)<<"bytesperpixel="<<bytesperpixel<<std::endl; osg::notify(osg::INFO)<<"bytesperpixel="<<bytesperpixel<<std::endl;
buffer = new unsigned char [w*h*format]; buffer = new unsigned char [w*h*format];
for(unsigned char* ptr=buffer;ptr<buffer+w*h*format;++ptr) *ptr = 0;
if (!buffer) if (!buffer)
{ {
@ -508,6 +507,9 @@ simage_tiff_load(std::istream& fin,
return NULL; return NULL;
} }
// initialize memory
for(unsigned char* ptr=buffer;ptr<buffer+w*h*format;++ptr) *ptr = 0;
width = w; width = w;
height = h; height = h;