]> git.ipfire.org Git - thirdparty/opentracker.git/commitdiff
Must not dealloc mmaped buffers with free()
authorerdgeist <>
Fri, 19 Oct 2007 03:39:04 +0000 (03:39 +0000)
committererdgeist <>
Fri, 19 Oct 2007 03:39:04 +0000 (03:39 +0000)
opentracker.c

index 28ac0713cd649243415c74783bb0506f6dc2072c..c547007bff4fd20c4a4c4c3e2a9d8e2056df3853 100644 (file)
@@ -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;
   }