Commit a336d9b6 authored by Michi Mutsuzaki's avatar Michi Mutsuzaki
Browse files

ZOOKEEPER-1632. fix memory leaks in cli_st (fpj via michim)


git-svn-id: https://svn.apache.org/repos/asf/zookeeper/branches/branch-3.4@1547703 13f79535-47bb-0310-9956-ffa450edef68
parent 33b5deed
......@@ -170,6 +170,8 @@ BUGFIXES:
ZOOKEEPER-1821. very ugly warning when compiling load_gen.c
(german blanco via fpj)
ZOOKEEPER-1632. fix memory leaks in cli_st (fpj via michim)
IMPROVEMENTS:
ZOOKEEPER-1564. Allow JUnit test build with IBM Java
......
......@@ -182,6 +182,11 @@ void my_string_completion(int rc, const char *name, const void *data) {
shutdownThisThing=1;
}
void my_string_completion_free_data(int rc, const char *name, const void *data) {
my_string_completion(rc, name, data);
free((void*)data);
}
void my_data_completion(int rc, const char *value, int value_len,
const struct Stat *stat, const void *data) {
struct timeval tv;
......@@ -418,7 +423,7 @@ void processline(char *line) {
// my_string_completion, strdup(line));
// }
rc = zoo_acreate(zh, line, "new", 3, &ZOO_OPEN_ACL_UNSAFE, flags,
my_string_completion, strdup(line));
my_string_completion_free_data, strdup(line));
if (rc) {
fprintf(stderr, "Error %d for %s\n", rc, line);
}
......@@ -442,7 +447,7 @@ void processline(char *line) {
fprintf(stderr, "Path must start with /, found: %s\n", line);
return;
}
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);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment