[
https://issues.apache.org/jira/browse/AVRO-4246?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18073510#comment-18073510
]
Fabio Carneiro commented on AVRO-4246:
--------------------------------------
I've added the git diff output as a png so it is possible to see how minimal
the changes are. All tests also pass following the steps on this page:
[https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=21791803#HowToContribute-UnitTests.]
> Memory Leak in avroc on failed decoding
> ---------------------------------------
>
> Key: AVRO-4246
> URL: https://issues.apache.org/jira/browse/AVRO-4246
> Project: Apache Avro
> Issue Type: Bug
> Components: c
> Affects Versions: 1.12.1
> Environment: On any installation of the avroc library that attempts
> to decode an incorrectly encoded string.
> Reporter: Fabio Carneiro
> Priority: Major
> Labels: bug, important, memory-bug
> Attachments: diff.png
>
> Original Estimate: 2h
> Remaining Estimate: 2h
>
> The _read_string_ and _read_bytes_ functions in the _binary_encoding.c_
> translation unit does not free the allocated buffer if an error results from
> a call to _read_value_ originating from the _AVRO_READ_ macro.
>
> My plan to fix the is to introduce a new macro called _AVRO_READ_OR_FREE_
> (name up for change) that frees the buffer in case of error.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)