(U+6215): Apply new conventions for glyph granularity.
[chise/xemacs-chise.git.1] / src / dgif_lib.c
index 6d91c90..df67571 100644 (file)
@@ -366,10 +366,11 @@ void DGifGetExtensionNext(GifFileType *GifFile, GifByteType **Extension)
 ******************************************************************************/
 int DGifCloseFile(GifFileType *GifFile)
 {
 ******************************************************************************/
 int DGifCloseFile(GifFileType *GifFile)
 {
-    GifFilePrivateType *Private = (GifFilePrivateType *)GifFile->Private;
+    GifFilePrivateType *Private;
 
     if (GifFile == NULL) return -1;
 
 
     if (GifFile == NULL) return -1;
 
+    Private = (GifFilePrivateType *)GifFile->Private;
     if (!IS_READABLE(Private))
     {
        /* This file was NOT open for reading: */
     if (!IS_READABLE(Private))
     {
        /* This file was NOT open for reading: */
@@ -930,7 +931,10 @@ ColorMapObject *MakeMapObject(int ColorCount, GifColorType *ColorMap)
 
     Object->Colors = (GifColorType *)calloc(ColorCount, sizeof(GifColorType));
     if (Object->Colors == (GifColorType *)NULL)
 
     Object->Colors = (GifColorType *)calloc(ColorCount, sizeof(GifColorType));
     if (Object->Colors == (GifColorType *)NULL)
+      {
+       free (Object);
        return((ColorMapObject *)NULL);
        return((ColorMapObject *)NULL);
+      }
 
     Object->ColorCount = ColorCount;
     Object->BitsPerPixel = BitSize(ColorCount);
 
     Object->ColorCount = ColorCount;
     Object->BitsPerPixel = BitSize(ColorCount);