giflib/SOURCES/giflib_coverity.patch

44 lines
1.4 KiB
Diff
Raw Normal View History

2022-05-17 09:16:35 +00:00
diff -rupN --no-dereference giflib-5.2.1/gif2rgb.c giflib-5.2.1-new/gif2rgb.c
--- giflib-5.2.1/gif2rgb.c 2019-06-24 09:24:27.000000000 +0200
+++ giflib-5.2.1-new/gif2rgb.c 2020-02-17 16:51:04.468397502 +0100
@@ -170,6 +170,8 @@ static void SaveGif(GifByteType *OutputB
/* Open stdout for the output file: */
if ((GifFile = EGifOpenFileHandle(1, &Error)) == NULL) {
PrintGifError(Error);
+ free(OutputBuffer);
+ GifFreeMapObject(OutputColorMap);
exit(EXIT_FAILURE);
}
@@ -179,6 +181,8 @@ static void SaveGif(GifByteType *OutputB
EGifPutImageDesc(GifFile,
0, 0, Width, Height, false, NULL) == GIF_ERROR) {
PrintGifError(Error);
+ free(OutputBuffer);
+ GifFreeMapObject(OutputColorMap);
exit(EXIT_FAILURE);
}
@@ -187,8 +191,11 @@ static void SaveGif(GifByteType *OutputB
GifFile->Image.Width, GifFile->Image.Height);
for (i = 0; i < Height; i++) {
- if (EGifPutLine(GifFile, Ptr, Width) == GIF_ERROR)
+ if (EGifPutLine(GifFile, Ptr, Width) == GIF_ERROR) {
+ free(OutputBuffer);
+ GifFreeMapObject(OutputColorMap);
exit(EXIT_FAILURE);
+ }
GifQprintf("\b\b\b\b%-4d", Height - i - 1);
Ptr += Width;
@@ -196,6 +203,8 @@ static void SaveGif(GifByteType *OutputB
if (EGifCloseFile(GifFile, &Error) == GIF_ERROR) {
PrintGifError(Error);
+ free(OutputBuffer);
+ GifFreeMapObject(OutputColorMap);
exit(EXIT_FAILURE);
}
}