[
https://issues.apache.org/jira/browse/ZOOKEEPER-3944?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17201756#comment-17201756
]
Damien Diederen edited comment on ZOOKEEPER-3944 at 9/24/20, 8:31 PM:
----------------------------------------------------------------------
Hi [~xiaotian_qi],
Argh; nice catch. The {{destroy}} "method" carefully unwinds the fields, but
is indeed missing a {{free}} of the structure itself.
(I would have put the {{free}} at the end of the {{destroy}} method—a bit like
how C++ {{delete}} works—but the patch generally looks fine to me.)
Are you planning to to submit this as a PR, or would you prefer I do it? (And
if I do, would you object to me moving the {{free}} inside the method, while
still keeping the patch attributed to you?)
Unless [~eolivelli] or [~symat] are okay with directly applying the attached
patch, of course.
Best,
Damien Diederen
was (Author: ztzg):
Hi [~xiaotian_qi],
Argh; nice catch. The {{destroy}} "method" carefully unwinds the fields, but
is indeed missing a {{free}} of the structure itself.
(I would have put the {{free}} at the end of the {{destroy}} method (a bit like
how a C++ {{delete}} works), but the patch generally looks fine to me.)
Best,
Damien Diederen
> zookeeper c api sasl client memory leak
> ---------------------------------------
>
> Key: ZOOKEEPER-3944
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-3944
> Project: ZooKeeper
> Issue Type: Bug
> Components: c client
> Affects Versions: 3.6.2
> Reporter: Xiaotian Qi
> Priority: Major
> Attachments: 0001-ZOOKEEPER-3944-Fix-sasl-memory-leak.patch
>
>
> I find this memory leak through sanitizer.
> [Here|https://github.com/apache/zookeeper/blob/master/zookeeper-client/zookeeper-client-c/src/zookeeper.c#L664-L665]
> within zookeeper_close() it destroy the client and reset it to NULL. This
> client is created using calloc()
> In zoo_sasl_client_destroy(), the client is not freed, neither within
> zookeeper_close().
> I would suggest add a free() before setting it to NULL in zookeeper_close
--
This message was sent by Atlassian Jira
(v8.3.4#803005)