{
string ext = FS::extpart(name);
if(ext==".png" || ext==".jpg")
- {
- IO::Seekable *io = open_from_sources(name);
- Graphics::Image image;
- image.load_io(*io);
- GL::Texture2D *tex = new GL::Texture2D;
- tex->set_min_filter(GL::LINEAR);
- tex->image(image);
- return tex;
- }
- else
- return 0;
+ if(IO::Seekable *io = open_from_sources(name))
+ {
+ Graphics::Image image;
+ image.load_io(*io);
+ delete io;
+
+ GL::Texture2D *tex = new GL::Texture2D;
+ tex->set_min_filter(GL::LINEAR);
+ tex->image(image);
+ return tex;
+ }
+
+ return 0;
}