kezhuw commented on code in PR #1929:
URL: https://github.com/apache/zookeeper/pull/1929#discussion_r1000452136
##########
zookeeper-client/zookeeper-client-c/src/zookeeper.c:
##########
@@ -1457,7 +1457,7 @@ zhandle_t *zookeeper_init_ssl(const char *host, const
char *cert, watcher_fn wat
zcert.ca = strtok(strdup(cert), ",");
Review Comment:
This sounds like a memory leak. I find only `free` of field `certstr` but
not `ca` in
[`destroy`](https://github.com/apache/zookeeper/blob/90f813ea38a85ff2715662bad75f9bb6387fe4a6/zookeeper-client/zookeeper-client-c/src/zookeeper.c#L692).
@symat @ztzg @anmolnar
##########
zookeeper-client/zookeeper-client-c/src/zookeeper.c:
##########
@@ -1457,7 +1457,7 @@ zhandle_t *zookeeper_init_ssl(const char *host, const
char *cert, watcher_fn wat
zcert.ca = strtok(strdup(cert), ",");
zcert.cert = strtok(NULL, ",");
zcert.key = strtok(NULL, ",");
- zcert.passwd = strtok(NULL, ",");
+ zcert.passwd = strtok(NULL, "");
Review Comment:
I think this need a test. I find no specified behavior for [`strtok(str,
"")`](https://cplusplus.com/reference/cstring/strtok/).
Besides this, I think this change require us to decide whether and how
possible more fields are allowed in future.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]