Re: segfault with std::allocator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Toon,

The deallocate function MUST NOT by passed in a NULL pointer. (According to ISO 14882.)

You can fix your code by...

#include <memory>
int main()
{
   std::allocator< int > int_alloc ;
   int* p = int_alloc.allocate( 0 ) ;
   if(p) int_alloc.deallocate( p, 0 ) ;
   return 0 ;
}

HTH,
--Eljay


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux