fix memleak
[enigma2.git] / lib / gdi / gpixmap.cpp
index e9c469c425714241441a5ad7717b3754e4887ce6..96a3e9b0ac4d4af2529333814a7c00b96ebf71a0 100644 (file)
@@ -74,15 +74,8 @@ gSurfaceSystem::gSurfaceSystem(eSize size, int _bpp)
                bypp=(bpp+7)/8;
        }
        stride=x*bypp;
-       if (bpp==8)
-       {
-               clut.colors=256;
-               clut.data=new gRGB[clut.colors];
-       } else
-       {
-               clut.colors=0;
-               clut.data=0;
-       }
+       clut.colors=0;
+       clut.data=0;
        data=malloc(x*y*bypp);
 }
 
@@ -388,6 +381,8 @@ gColor gPalette::findColor(const gRGB &rgb) const
                ttd+=td;
                if (ttd>=difference)
                        continue;
+               if (!ttd)
+                       return t;
                difference=ttd;
                best_choice=t;
        }