diff options
Diffstat (limited to 'apps/plugins/imageviewer/gif/gif.c')
-rw-r--r-- | apps/plugins/imageviewer/gif/gif.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/apps/plugins/imageviewer/gif/gif.c b/apps/plugins/imageviewer/gif/gif.c index b78709556d..0521c29e3a 100644 --- a/apps/plugins/imageviewer/gif/gif.c +++ b/apps/plugins/imageviewer/gif/gif.c | |||
@@ -132,6 +132,8 @@ static int load_image(char *filename, struct image_info *info, | |||
132 | time = *rb->current_tick - time; | 132 | time = *rb->current_tick - time; |
133 | } | 133 | } |
134 | 134 | ||
135 | gif_decoder_destroy_memory_pool(p_decoder); | ||
136 | |||
135 | if (!iv->running_slideshow && !p_decoder->error) | 137 | if (!iv->running_slideshow && !p_decoder->error) |
136 | { | 138 | { |
137 | rb->snprintf(print, sizeof(print), " %ld.%02ld sec ", time/HZ, time%HZ); | 139 | rb->snprintf(print, sizeof(print), " %ld.%02ld sec ", time/HZ, time%HZ); |
@@ -142,6 +144,9 @@ static int load_image(char *filename, struct image_info *info, | |||
142 | 144 | ||
143 | if (p_decoder->error) | 145 | if (p_decoder->error) |
144 | { | 146 | { |
147 | if (p_decoder->error == D_GIF_ERR_NOT_ENOUGH_MEM) | ||
148 | return PLUGIN_OUTOFMEM; | ||
149 | |||
145 | rb->splashf(HZ, "%s", GifErrorString(p_decoder->error)); | 150 | rb->splashf(HZ, "%s", GifErrorString(p_decoder->error)); |
146 | return PLUGIN_ERROR; | 151 | return PLUGIN_ERROR; |
147 | } | 152 | } |
@@ -157,12 +162,9 @@ static int load_image(char *filename, struct image_info *info, | |||
157 | img_size = (p_decoder->native_img_size*p_decoder->frames_count + 3) & ~3; | 162 | img_size = (p_decoder->native_img_size*p_decoder->frames_count + 3) & ~3; |
158 | disp_size = (sizeof(unsigned char *)*p_decoder->frames_count*4 + 3) & ~3; | 163 | disp_size = (sizeof(unsigned char *)*p_decoder->frames_count*4 + 3) & ~3; |
159 | 164 | ||
165 | /* No memory to allocate disp matrix */ | ||
160 | if (memory_size < img_size + disp_size) | 166 | if (memory_size < img_size + disp_size) |
161 | { | 167 | return PLUGIN_OUTOFMEM; |
162 | /* No memory to allocate disp matrix */ | ||
163 | rb->splashf(HZ, "%s", GifErrorString(D_GIF_ERR_NOT_ENOUGH_MEM)); | ||
164 | return PLUGIN_ERROR; | ||
165 | } | ||
166 | 168 | ||
167 | disp = (unsigned char **)(p_decoder->mem + img_size); | 169 | disp = (unsigned char **)(p_decoder->mem + img_size); |
168 | disp_buf = (unsigned char *)disp + disp_size; | 170 | disp_buf = (unsigned char *)disp + disp_size; |