diff options
author | erdgeist <> | 2007-10-21 01:11:45 +0000 |
---|---|---|
committer | erdgeist <> | 2007-10-21 01:11:45 +0000 |
commit | ddd85ec7e08d38fc46e0e96f01205d1ce4087aea (patch) | |
tree | 9470ad8ab5e47f43e4df0814d3bf2cbaf7761a4e /opentracker.c | |
parent | 8098adb48eb9d3409e6b569d30dfb4391e3224c2 (diff) |
Fixed one leak from struct_http
Diffstat (limited to 'opentracker.c')
-rw-r--r-- | opentracker.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/opentracker.c b/opentracker.c index 7e06044..f29e076 100644 --- a/opentracker.c +++ b/opentracker.c | |||
@@ -610,8 +610,9 @@ static void handle_read( const int64 clientsocket ) { | |||
610 | ssize_t l; | 610 | ssize_t l; |
611 | 611 | ||
612 | if( ( l = io_tryread( clientsocket, static_inbuf, sizeof static_inbuf ) ) <= 0 ) { | 612 | if( ( l = io_tryread( clientsocket, static_inbuf, sizeof static_inbuf ) ) <= 0 ) { |
613 | if( h && ( h->flag & STRUCT_HTTP_FLAG_ARRAY_USED ) ) { | 613 | if( h ) { |
614 | array_reset( &h->request ); | 614 | if( h->flag & STRUCT_HTTP_FLAG_ARRAY_USED ) |
615 | array_reset( &h->request ); | ||
615 | free( h ); | 616 | free( h ); |
616 | } | 617 | } |
617 | io_close( clientsocket ); | 618 | io_close( clientsocket ); |
@@ -645,7 +646,8 @@ static void handle_read( const int64 clientsocket ) { | |||
645 | 646 | ||
646 | static void handle_write( const int64 clientsocket ) { | 647 | static void handle_write( const int64 clientsocket ) { |
647 | struct http_data* h=io_getcookie( clientsocket ); | 648 | struct http_data* h=io_getcookie( clientsocket ); |
648 | if( !h || ( iob_send( clientsocket, &h->batch ) <= 0 ) ) { | 649 | if( !h ) return; |
650 | if( iob_send( clientsocket, &h->batch ) <= 0 ) { | ||
649 | iob_reset( &h->batch ); | 651 | iob_reset( &h->batch ); |
650 | io_close( clientsocket ); | 652 | io_close( clientsocket ); |
651 | free( h ); | 653 | free( h ); |
@@ -666,14 +668,12 @@ static void handle_accept( const int64 serversocket ) { | |||
666 | io_close( i ); | 668 | io_close( i ); |
667 | continue; | 669 | continue; |
668 | } | 670 | } |
669 | 671 | io_setcookie( i, h ); | |
670 | io_wantread( i ); | 672 | io_wantread( i ); |
671 | 673 | ||
672 | byte_zero( h, sizeof( struct http_data ) ); | 674 | byte_zero( h, sizeof( struct http_data ) ); |
673 | memmove( h->ip, ip, sizeof( ip ) ); | 675 | memmove( h->ip, ip, sizeof( ip ) ); |
674 | 676 | ||
675 | io_setcookie( i, h ); | ||
676 | |||
677 | ++ot_overall_tcp_connections; | 677 | ++ot_overall_tcp_connections; |
678 | 678 | ||
679 | /* That breaks taia encapsulation. But there is no way to take system | 679 | /* That breaks taia encapsulation. But there is no way to take system |