From: Andreas Ă–man Date: Sat, 11 Aug 2007 07:21:25 +0000 (+0000) Subject: Fix use-after-free issues when client disconnects X-Git-Tag: 2.12~1504 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=74838ecc55704c8f6bb100a35f450dc09ca5946b;p=thirdparty%2Ftvheadend.git Fix use-after-free issues when client disconnects --- diff --git a/output_client.c b/output_client.c index e974c1f79..1fc29dafa 100644 --- a/output_client.c +++ b/output_client.c @@ -651,8 +651,10 @@ client_data_read(client_t *c) int r, cr = 0, i; char buf[100]; - if(space < 1) + if(space < 1) { client_teardown(c, EBADMSG); + return; + } r = read(c->c_fd, c->c_input_buf + c->c_input_buf_ptr, space); if(r < 0) { @@ -701,12 +703,13 @@ client_socket_callback(int events, void *opaque, int fd) { client_t *c = opaque; - if(events & DISPATCH_ERR) + if(events & DISPATCH_ERR) { client_teardown(c, ECONNRESET); + return; + } if(events & DISPATCH_READ) client_data_read(c); - }