From 7facdca7c29dadb8424d8e302fc923f930aaf68a Mon Sep 17 00:00:00 2001 From: Eric Chen Date: Wed, 1 Dec 2021 15:14:16 -0800 Subject: [PATCH 1/2] Fixes a memory leak issue in reader api. --- ionc/ion_reader.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ionc/ion_reader.c b/ionc/ion_reader.c index b41fb93..aab69bb 100644 --- a/ionc/ion_reader.c +++ b/ionc/ion_reader.c @@ -1917,7 +1917,12 @@ iERR _ion_reader_process_possible_symbol_table(ION_READER *preader, BOOL *is_sym preader->_local_symtab_pool = owner; preader->_current_symtab = local; } - iRETURN; + SUCCEED(); +fail: + if (owner != NULL) { + ion_free_owner(owner); + } + return err; } iERR ion_reader_get_position(hREADER hreader, int64_t *p_bytes, int32_t *p_line, int32_t *p_offset) From b748dc8cae6181232a4025e1614f76bf46a58a72 Mon Sep 17 00:00:00 2001 From: Eric Chen Date: Wed, 1 Dec 2021 15:44:12 -0800 Subject: [PATCH 2/2] change success() to return IERR_OK --- ionc/ion_reader.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ionc/ion_reader.c b/ionc/ion_reader.c index aab69bb..43a020c 100644 --- a/ionc/ion_reader.c +++ b/ionc/ion_reader.c @@ -1917,7 +1917,7 @@ iERR _ion_reader_process_possible_symbol_table(ION_READER *preader, BOOL *is_sym preader->_local_symtab_pool = owner; preader->_current_symtab = local; } - SUCCEED(); + return IERR_OK; fail: if (owner != NULL) { ion_free_owner(owner);