我有这个代码
struct PDATA{
int NTH;
int NPH;
double th_start;
double th_step;
double ph_start;
double ph_step;
};
typedef struct PDATA *PDATA_P;
struct PDATA PAT_DATA;
PDATA_P PAT_DATA_P;
PAT_DATA_P = (PDATA_P) malloc(sizeof(struct PDATA));
PAT_DATA_P=&PAT_DATA;
....
free(PAT_DATA_P);
当我释放指针时,我收到此错误:
*** glibc detected *** /home/pc-linux/Desktop/Projects/AM_v0.1/Debug/AM_v0.1: free(): invalid pointer: 0xbfffe03c ***
错误在哪里?