This is an automated email from the ASF dual-hosted git repository.

kezhuw pushed a commit to branch branch-3.9
in repository https://gitbox.apache.org/repos/asf/zookeeper.git


The following commit(s) were added to refs/heads/branch-3.9 by this push:
     new 15423a4d0 ZOOKEEPER-4020: Fix memory leak from ssl cert in c client
15423a4d0 is described below

commit 15423a4d02fc12f6234fc760127a60c0dc345f6e
Author: Gowrima <kj.gowr...@gmail.com>
AuthorDate: Fri Dec 6 21:58:18 2024 -0800

    ZOOKEEPER-4020: Fix memory leak from ssl cert in c client
    
    Reviewers: kezhuw
    Author: Gowrima
    Closes #2209 from Gowrima/ZOOKEEPER-4020
    
    (cherry picked from commit f7af2acd7f92868507e66780bf6818f47d068a77)
    Signed-off-by: Kezhu Wang <kez...@apache.org>
---
 zookeeper-client/zookeeper-client-c/src/zookeeper.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/zookeeper-client/zookeeper-client-c/src/zookeeper.c 
b/zookeeper-client/zookeeper-client-c/src/zookeeper.c
index 633bf3776..c07700788 100644
--- a/zookeeper-client/zookeeper-client-c/src/zookeeper.c
+++ b/zookeeper-client/zookeeper-client-c/src/zookeeper.c
@@ -1454,7 +1454,7 @@ zhandle_t *zookeeper_init_ssl(const char *host, const 
char *cert, watcher_fn wat
 {
     zcert_t zcert;
     zcert.certstr = strdup(cert);
-    zcert.ca = strtok(strdup(cert), ",");
+    zcert.ca = strtok(zcert.certstr, ",");
     zcert.cert = strtok(NULL, ",");
     zcert.key = strtok(NULL, ",");
     zcert.passwd = strtok(NULL, ",");       

Reply via email to