zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mic...@apache.org
Subject svn commit: r1547703 - in /zookeeper/branches/branch-3.4: CHANGES.txt src/c/src/cli.c
Date Wed, 04 Dec 2013 04:20:53 GMT
Author: michim
Date: Wed Dec  4 04:20:53 2013
New Revision: 1547703

URL: http://svn.apache.org/r1547703
Log:
ZOOKEEPER-1632. fix memory leaks in cli_st (fpj via michim)

Modified:
    zookeeper/branches/branch-3.4/CHANGES.txt
    zookeeper/branches/branch-3.4/src/c/src/cli.c

Modified: zookeeper/branches/branch-3.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/CHANGES.txt?rev=1547703&r1=1547702&r2=1547703&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.4/CHANGES.txt Wed Dec  4 04:20:53 2013
@@ -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

Modified: zookeeper/branches/branch-3.4/src/c/src/cli.c
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/c/src/cli.c?rev=1547703&r1=1547702&r2=1547703&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/c/src/cli.c (original)
+++ zookeeper/branches/branch-3.4/src/c/src/cli.c Wed Dec  4 04:20:53 2013
@@ -182,6 +182,11 @@ void my_string_completion(int rc, const 
       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);
         }



Mime
View raw message