This error happens when I run a rake task. Got this after upgrading nokogiri gem. Have no idea at first what it is.. but the malloc clue makes me recall that this kind of stuff was once happened when I tried to setup dashboard.io project on my laptop.
Luckily, the collegue of mine found the solution. It's because the corruption of libxml2. The solution is to re-install it and repolish nokogiri gem.
$ brew install libxml2 # or possibly upgrade
$ brew link libxml2
$ gem pristine nokogiri
$ brew unlink libxml2