Skip to content

Commit

Permalink
Fix possible NULL dereference in createExtrudedMesh
Browse files Browse the repository at this point in the history
  • Loading branch information
kahrl committed Jul 6, 2013
1 parent 922a30e commit 3607fae
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,17 @@ scene::IAnimatedMesh* createExtrudedMesh(video::ITexture *texture,

// img1 is in the texture's color format, convert to 8-bit ARGB
video::IImage *img2 = driver->createImage(video::ECF_A8R8G8B8, size);
if (img2 != NULL)
if (img2 == NULL)
{
img1->copyTo(img2);

mesh = extrudeARGB(size.Width, size.Height, (u8*) img2->lock());
img2->unlock();
img2->drop();
img1->drop();
return NULL;
}

img1->copyTo(img2);
img1->drop();
mesh = extrudeARGB(size.Width, size.Height, (u8*) img2->lock());
img2->unlock();
img2->drop();
}

// Set default material
Expand Down

0 comments on commit 3607fae

Please sign in to comment.