From f56e40c24ee299d9246af0903375590b63f13327 Mon Sep 17 00:00:00 2001 From: erdgeist <> Date: Fri, 19 Oct 2007 03:39:04 +0000 Subject: [PATCH] Must not dealloc mmaped buffers with free() --- opentracker.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/opentracker.c b/opentracker.c index 28ac071..c547007 100644 --- a/opentracker.c +++ b/opentracker.c @@ -144,8 +144,10 @@ static void sendmmapdata( const int64 s, char *buffer, size_t size ) { size_t header_size; tai6464 t; - if( !h ) - return free( buffer ); + if( !h ) { + munmap( buffer, size ); + return; + } if( h->flag & STRUCT_HTTP_FLAG_ARRAY_USED ) { h->flag &= ~STRUCT_HTTP_FLAG_ARRAY_USED; array_reset( &h->request ); @@ -153,7 +155,7 @@ static void sendmmapdata( const int64 s, char *buffer, size_t size ) { header = malloc( SUCCESS_HTTP_HEADER_LENGTH ); if( !header ) { - free( buffer ); + munmap( buffer, size ); HTTPERROR_500; }