Fix memory leak problems reported in
@@ -237,17 +237,16 @@ sixel_decoder_decode(
sixel_decoder_t /* in */ *decoder)
{
SIXELSTATUS status = SIXEL_FALSE;
- unsigned char *raw_data;
+ unsigned char *raw_data = NULL;
int sx;
int sy;
int raw_len;
int max;
int n;
FILE *input_fp = NULL;
- unsigned char *indexed_pixels;
- unsigned char *palette;
+ unsigned char *indexed_pixels = NULL;
+ unsigned char *palette = NULL;
int ncolors;
- unsigned char *pixels = NULL;
sixel_decoder_ref(decoder);
@@ -327,7 +326,9 @@ sixel_decoder_decode(
}
end:
- sixel_allocator_free(decoder->allocator, pixels);
+ sixel_allocator_free(decoder->allocator, raw_data);
+ sixel_allocator_free(decoder->allocator, indexed_pixels);
+ sixel_allocator_free(decoder->allocator, palette);
sixel_decoder_unref(decoder);
return status;
