[
https://issues.apache.org/jira/browse/ZOOKEEPER-1632?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13837149#comment-13837149
]
Raul Gutierrez Segales commented on ZOOKEEPER-1632:
---------------------------------------------------
Actually, what happens in:
{noformat}
- rc = zoo_async(zh, line, my_string_completion, strdup(line));
+ rc = zoo_async(zh, line, my_string_completion_free_data, strdup(line));
if (rc) {
fprintf(stderr, "Error %d for %s\n", rc, line);
}
{noformat}
when rc != 0? It seems that my_string_completion_free_data wouldn't be call at
that point, so the result of strdup(line) wouldn't be free. We should probs
save it in a temp ptr and free that when zoo_async returns rc != 0.
> fix memory leaks in cli_st
> ---------------------------
>
> Key: ZOOKEEPER-1632
> URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1632
> Project: ZooKeeper
> Issue Type: Bug
> Components: c client
> Reporter: Colin Patrick McCabe
> Assignee: Colin Patrick McCabe
> Priority: Minor
> Fix For: 3.4.6, 3.5.0
>
> Attachments: ZOOKEEPER-1632-b3.4.patch, ZOOKEEPER-1632-trunk.patch,
> ZOOKEEPER-1632.001.patch, ZOOKEEPER-1632.002.patch
>
>
> Fix two memory leaks revealed by running:
> {code}
> valgrind --leak-check=full ./.libs/cli_st 127.0.0.1:2182
> create /foo
> quit
> {code}
--
This message was sent by Atlassian JIRA
(v6.1#6144)