diff options
| author | erdgeist <> | 2007-10-19 03:39:04 +0000 |
|---|---|---|
| committer | erdgeist <> | 2007-10-19 03:39:04 +0000 |
| commit | f56e40c24ee299d9246af0903375590b63f13327 (patch) | |
| tree | ef422768ba432571bda99ad8c3169941123b33f6 | |
| parent | d25cf9307ecb9a09d1c8b87f291aab5abe4b02b9 (diff) | |
Must not dealloc mmaped buffers with free()
| -rw-r--r-- | opentracker.c | 8 |
1 files 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 ) { | |||
| 144 | size_t header_size; | 144 | size_t header_size; |
| 145 | tai6464 t; | 145 | tai6464 t; |
| 146 | 146 | ||
| 147 | if( !h ) | 147 | if( !h ) { |
| 148 | return free( buffer ); | 148 | munmap( buffer, size ); |
| 149 | return; | ||
| 150 | } | ||
| 149 | if( h->flag & STRUCT_HTTP_FLAG_ARRAY_USED ) { | 151 | if( h->flag & STRUCT_HTTP_FLAG_ARRAY_USED ) { |
| 150 | h->flag &= ~STRUCT_HTTP_FLAG_ARRAY_USED; | 152 | h->flag &= ~STRUCT_HTTP_FLAG_ARRAY_USED; |
| 151 | array_reset( &h->request ); | 153 | array_reset( &h->request ); |
| @@ -153,7 +155,7 @@ static void sendmmapdata( const int64 s, char *buffer, size_t size ) { | |||
| 153 | 155 | ||
| 154 | header = malloc( SUCCESS_HTTP_HEADER_LENGTH ); | 156 | header = malloc( SUCCESS_HTTP_HEADER_LENGTH ); |
| 155 | if( !header ) { | 157 | if( !header ) { |
| 156 | free( buffer ); | 158 | munmap( buffer, size ); |
| 157 | HTTPERROR_500; | 159 | HTTPERROR_500; |
| 158 | } | 160 | } |
| 159 | 161 | ||
