Used mysql's malloc, free, and error.  Minor cosmetic changes.