fix memory corruption in map_buffer TBUG-411 TQC-24
Signed-off-by: Sylvain Trosset <trosset.sylvain@gmail.com>