kezhuw commented on code in PR #2256:
URL: https://github.com/apache/zookeeper/pull/2256#discussion_r2078777336


##########
zookeeper-client/zookeeper-client-c/src/zookeeper.c:
##########
@@ -4650,11 +4650,19 @@ int zoo_amulti(zhandle_t *zh, int count, const zoo_op_t 
*ops,
     struct RequestHeader h = {get_xid(), ZOO_MULTI_OP};
     struct MultiHeader mh = {-1, 1, -1};
     struct oarchive *oa = create_buffer_oarchive();
-    completion_head_t clist = { 0 };
+    completion_head_t clist;
+    int rc, index;
 
-    int rc = serialize_RequestHeader(oa, "header", &h);
+    /* initialize mutex and condition variable in clist */
+    clist.head = NULL;
+    clist.last = NULL;
+#ifdef THREADED

Review Comment:
   I checked code related to `zoo_amulti` and did not find concurrent usage of 
this list. The list is constructed in `zoo_amulti` and deconstructed in 
`deserialize_multi`. I would recommend to use `queue_completion_nolock` and 
`dequeue_completion_nolock` in these two places. Regarding the fix, the inited 
mutex/cond will leak as they are not destroyed.



-- 
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: notifications-unsubscr...@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to