I already did more than 20 tests in different ways and this function:
Code: Select all
int
DGifCloseFile(GifFileType * GifFile) {
GifFilePrivateType *Private;
FILE *File;
if (GifFile == NULL)
return GIF_ERROR;
Private = (GifFilePrivateType *) GifFile->Private;
if (!IS_READABLE(Private)) {
/* This file was NOT open for reading: */
_GifError = D_GIF_ERR_NOT_READABLE;
return GIF_ERROR;
}
File = Private->File;
if (GifFile->Image.ColorMap) {
FreeMapObject(GifFile->Image.ColorMap);
GifFile->Image.ColorMap = NULL;
}
if (GifFile->SColorMap) {
FreeMapObject(GifFile->SColorMap);
GifFile->SColorMap = NULL;
}
if (Private) {
free((char *)Private);
Private = NULL;
}
if (GifFile->SavedImages) {
FreeSavedImages(GifFile);
GifFile->SavedImages = NULL;
}
free(GifFile);
if (File && (fclose(File) != 0)) {
_GifError = D_GIF_ERR_CLOSE_FAILED;
return GIF_ERROR;
}
return GIF_OK;
}
Edit:
this is the original giflib code and not the giflib im using. I am using the one that J.F. posted. I am currently fixing some errors in the original one so I can use it and try it
Edit2:
J.F. if you see this please answer me, in the compiled version of gif lib, did you include the close function?