Skip to content

Commit f94bc6f

Browse files
committed
Fix memory leak problems reported in #67
#67
1 parent 5db717d commit f94bc6f

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/decoder.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,17 +237,16 @@ sixel_decoder_decode(
237237
sixel_decoder_t /* in */ *decoder)
238238
{
239239
SIXELSTATUS status = SIXEL_FALSE;
240-
unsigned char *raw_data;
240+
unsigned char *raw_data = NULL;
241241
int sx;
242242
int sy;
243243
int raw_len;
244244
int max;
245245
int n;
246246
FILE *input_fp = NULL;
247-
unsigned char *indexed_pixels;
248-
unsigned char *palette;
247+
unsigned char *indexed_pixels = NULL;
248+
unsigned char *palette = NULL;
249249
int ncolors;
250-
unsigned char *pixels = NULL;
251250

252251
sixel_decoder_ref(decoder);
253252

@@ -327,7 +326,9 @@ sixel_decoder_decode(
327326
}
328327

329328
end:
330-
sixel_allocator_free(decoder->allocator, pixels);
329+
sixel_allocator_free(decoder->allocator, raw_data);
330+
sixel_allocator_free(decoder->allocator, indexed_pixels);
331+
sixel_allocator_free(decoder->allocator, palette);
331332
sixel_decoder_unref(decoder);
332333

333334
return status;

0 commit comments

Comments
 (0)