Details
Description
If you give invalid hostname to zookeeper_init method, it's not able to resolve it, and it tries to do the cleanup (free buffer/completion lists/etc) . The adaptor_init() is not called for this code path, so the lock,cond variables (for adaptor, completion lists) are not initialized.
As part of the cleanup it's trying to clean up some buffers and acquires locks and unlocks (where the locks have not yet been initialized, so unlocking fails)
lock_completion_list(&zh->sent_requests); - pthread_mutex/cond not initialized
tmp_list = zh->sent_requests;
zh->sent_requests.head = 0;
zh->sent_requests.last = 0;
unlock_completion_list(&zh->sent_requests); trying to broadcast here on uninitialized cond
It should do error checking to see if locking succeeds before unlocking it. If Locking fails, then appropriate error handling has to be done.
Attachments
Attachments
Issue Links
- breaks
-
ZOOKEEPER-2443 Invalid Memory Access (SEGFAULT) and undefined behaviour in c client
- Open