jeudi 2 avril 2015

std::vector with memset_s allocator

I have some security critical code, and I'd like to make sure that sensitive buffers are always erased before being freed. I can implement a buffer class which calls memset_s in its destructor, but perhaps there is a more convenient way.


If I replace std::allocator with a variant that calls memset_s in deallocate(), will that force std::vector not to allocate T objects anywhere else except as temporaries?


Thanks.


Aucun commentaire:

Enregistrer un commentaire