Replace malloc(), calloc() and free() calls with proper APIs
EUCA-6166
Merge branch 'dev/chuck/MEM-FIX' into testing