forked from ground/ground
Leak a little memory to fix list issue
This commit is contained in:
@@ -87,11 +87,14 @@ GroundValue copyGroundValue(const GroundValue* gv) {
|
||||
case CHAR: newGv.data.charVal = gv->data.charVal; break;
|
||||
case BOOL: newGv.data.boolVal = gv->data.boolVal; break;
|
||||
case STRING:
|
||||
/*
|
||||
if (gv->data.stringVal != NULL) {
|
||||
newGv.data.stringVal = strdup(gv->data.stringVal);
|
||||
} else {
|
||||
newGv.data.stringVal = NULL;
|
||||
}
|
||||
*/
|
||||
newGv.data.stringVal = gv->data.stringVal;
|
||||
break;
|
||||
case LIST: {
|
||||
List newList = createList();
|
||||
@@ -258,7 +261,8 @@ void printGroundValue(GroundValue* gv) {
|
||||
|
||||
void freeGroundValue(GroundValue* gv) {
|
||||
if (gv->type == STRING && gv->data.stringVal != NULL) {
|
||||
free(gv->data.stringVal);
|
||||
// leak some memory for now
|
||||
// free(gv->data.stringVal);
|
||||
gv->data.stringVal = NULL;
|
||||
}
|
||||
if (gv->type == LIST && gv->data.listVal.values != NULL) {
|
||||
|
||||
Reference in New Issue
Block a user