Chang Sai

Problem with Malloc and Free use MCF52233 in CodeWarrior 6.3

Discussion created by Chang Sai on Aug 23, 2009
Latest reply on Aug 23, 2009 by Mark Butcher

Hi , I create a project about MCF52233Demo Programe in Code Warroir 6.3.

 

But I can't use Malloc and free. At first I malloc a memory,when I free it, the chip is halt.

 

For Example:  Code is,

 

char * pt = (char *)malloc(10*sizeof(char));

        pt[0] = 'a';

        free(pt);

        pt = NULL; 

 

 

I debug it, when step in the "free(pt)", It appear the error dialog :

 

   Exception vector nam:BUS Error , PC Where the exception happend ox200012A6 

 

 

please help me! 

Outcomes