From: mornfall@sourceware.org <mornfall@sourceware.org>
To: lvm-devel@redhat.com
Subject: LVM2/daemons/common daemon-server.c
Date: 15 Jan 2012 10:33:42 -0000 [thread overview]
Message-ID: <20120115103342.6707.qmail@sourceware.org> (raw)
CVSROOT: /cvs/lvm2
Module name: LVM2
Changes by: mornfall at sourceware.org 2012-01-15 10:33:41
Modified files:
daemons/common : daemon-server.c
Log message:
Fix a couple of resource leaks in daemon-common server code -- filehandles and
unjoined threads were leaked for each connection.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/common/daemon-server.c.diff?cvsroot=lvm2&r1=1.14&r2=1.15
--- LVM2/daemons/common/daemon-server.c 2011/09/17 14:49:18 1.14
+++ LVM2/daemons/common/daemon-server.c 2012/01/15 10:33:41 1.15
@@ -251,9 +251,6 @@
if (!req.cft)
fprintf(stderr, "error parsing request:\n %s\n", req.buffer);
res = b->s.handler(b->s, b->client, req);
- if (req.cft)
- dm_config_destroy(req.cft);
- dm_free(req.buffer);
if (!res.buffer) {
dm_config_write_node(res.cft->root, buffer_line, &res);
@@ -261,12 +258,17 @@
dm_config_destroy(res.cft);
}
+ if (req.cft)
+ dm_config_destroy(req.cft);
+ dm_free(req.buffer);
+
write_buffer(b->client.socket_fd, res.buffer, strlen(res.buffer));
free(res.buffer);
}
fail:
/* TODO what should we really do here? */
+ close(b->client.socket_fd);
free(baton);
return NULL;
}
@@ -291,6 +293,8 @@
if (pthread_create(&baton->client.thread_id, NULL, client_thread, baton))
return 0;
+ pthread_detach(baton->client.thread_id);
+
return 1;
}
next reply other threads:[~2012-01-15 10:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-15 10:33 mornfall [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-02-28 14:25 LVM2/daemons/common daemon-server.c zkabelac
2012-02-28 13:05 prajnoha
2012-01-25 21:30 zkabelac
2011-07-20 18:23 mornfall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120115103342.6707.qmail@sourceware.org \
--to=mornfall@sourceware.org \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.