| View previous topic :: View next topic |
| Author |
Message |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Tue Sep 09, 2008 11:00 pm Post subject: GifLib does not free image? |
|
|
I am pulling my hairs off.
I already did more than 20 tests in different ways and this function:
| Code: |
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;
}
|
I don't know what's wrong.
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? _________________
Upgrade your PSP |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Wed Sep 10, 2008 12:09 am Post subject: |
|
|
Sorry for the double post, I just want to say it is fixed :) _________________
Upgrade your PSP |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Wed Sep 10, 2008 1:44 am Post subject: |
|
|
| Pirata Nervo wrote: | | Sorry for the double post, I just want to say it is fixed :) |
It would help others if people would post the "fixes" they discover to problems, even if it's only to say they spelled a function wrong or passed the wrong pointer. |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Wed Sep 10, 2008 2:56 am Post subject: |
|
|
I was just doing it wrong, I had an if that would never be true.
And inside that if I called the function I posted.
But it works now because the if can be true now :P _________________
Upgrade your PSP |
|
| Back to top |
|
 |
J.F.
Joined: 22 Feb 2004 Posts: 2906
|
Posted: Wed Sep 10, 2008 7:44 am Post subject: |
|
|
| See? Now the next person that has trouble freeing a gif won't bug you asking if their problem isn't the same as yours. :D |
|
| Back to top |
|
 |
Pirata Nervo
Joined: 09 Oct 2007 Posts: 409
|
Posted: Wed Sep 10, 2008 7:53 am Post subject: |
|
|
lol ok I will start doing this _________________
Upgrade your PSP |
|
| Back to top |
|
 |
|