memory bug corrected
This commit is contained in:
@@ -146,7 +146,7 @@ CocVar *CocDefVar(const char *name, void *var, int type, int *flag) {
|
||||
assert(varListHdl!=NULL);
|
||||
p=CocFindVar1(*varListHdl, name);
|
||||
if (p==NULL) {
|
||||
p=malloc(sizeof(*p));
|
||||
p=my_malloc(sizeof(*p), name);
|
||||
p->next=*varListHdl;
|
||||
*varListHdl=p;
|
||||
str_copy(p->name, name);
|
||||
@@ -238,7 +238,8 @@ void CocFreeVarList(CocVar **varList) {
|
||||
p=v;
|
||||
v=p->next;
|
||||
p->next=NULL;
|
||||
free(p);
|
||||
printf("my_free %s\n", p->name);
|
||||
my_free(p);
|
||||
}
|
||||
*varList=NULL;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user