mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
clvmd: fix clean memory on exit
Properly clean 'client' structure only for LOCAL_SOCK type.
(Fixes bug from commit 460c19df62
)
(in release fix)
Also cleanup-up associated pthreads by using cleanup_zombie() function.
Since this function may change the list, restart scanning always from
the list header.
Note: couple following patches are necessary to make this working properly.
This commit is contained in:
parent
486b15d36c
commit
5bea2b5c82
@ -625,18 +625,13 @@ int main(int argc, char *argv[])
|
||||
close_local_sock(local_sock);
|
||||
destroy_lvm();
|
||||
|
||||
for (newfd = local_client_head.next; newfd != NULL;) {
|
||||
delfd = newfd;
|
||||
newfd = newfd->next;
|
||||
if (delfd->fd == local_sock)
|
||||
delfd->fd = -1;
|
||||
/*
|
||||
* FIXME:
|
||||
* needs cleanup code from read_from_local_sock() for now
|
||||
* break of 'clvmd' may access already free memory here.
|
||||
*/
|
||||
safe_close(&(delfd->fd));
|
||||
cmd_client_cleanup(delfd);
|
||||
while ((delfd = local_client_head.next)) {
|
||||
local_client_head.next = delfd->next;
|
||||
/* Failing cleanup_zombie leaks... */
|
||||
if (delfd->type == LOCAL_SOCK && !cleanup_zombie(delfd))
|
||||
cmd_client_cleanup(delfd); /* calls sync_unlock */
|
||||
if (delfd->fd != local_sock)
|
||||
safe_close(&(delfd->fd));
|
||||
dm_free(delfd);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user