Replace deprecated malloc.h with proper stdlib.h
Don't use /usr based path on FreeBSD

Third party software is always installed into /usr/local there
Merge pull request #478 from AMDmi3/master

FreeBSD fixes