Relating to a previous question of mine
I\'ve successfully interposed malloc
, but calloc
seems to be more problematic.
That is with ce
With regard to __nano_init()
being called twice: You've declared the function as a constructor, so it's called when the library is loaded, and it's called a second time explicitly when your malloc()
and calloc()
implementations are first called. Pick one.
With regard to the calloc()
interposer crashing your application: Some of the functions you're using, including dlsym()
and fprintf()
, may themselves be attempting to allocate memory, calling your interposer functions. Consider the consequences, and act accordingly.