如何释放堆栈分配结构的 malloc 属性?

How can I free a malloc'd attribute of a stack-allocated struct?

typedef struct {
int s;
...
char* temp_status;
...
} param;

pararm MQK;
MQK.temp_status = (char*) malloc(sizeof(char)*14); 

...

free(&(MQK.temp_status));    <<< ERROR

报错

gcc ...
csim.c: In function ‘main’:
csim.c:348:9: error: attempt to free a non-heap object ‘MQK’ [-  Werror=free-nonheap-object]
 free(&(MQK.temp_status));
     ^
cc1: all warnings being treated as errors

我应该如何释放它?我必须 free() 堆栈分配结构的 malloc() 属性。

MQK.temp_status 是一个字符指针。你为它 malloc,你可以释放它

free(MQK.temp_status); 

我说的对吗

每个指针都有一个地址。而且您不能释放该地址 &MQK.temp_status