if(!global) {
for(i = 0; sn->local_variables[i] != NULL; i++) {
if(strcmp(sn->local_variables[i]->key, name) == 0) {
- sn->local_variables[i]->value = gen;
+ sn->local_variables[i]->value = sn_generic_dup(gen);
replaced = true;
return sn->local_variables[i];
}
}
sn->local_variables[i] = malloc(sizeof(struct sn_generic));
sn->local_variables[i]->key = sn_strdup(name);
- sn->local_variables[i]->value = gen;
+ sn->local_variables[i]->value = sn_generic_dup(gen);
sn->local_variables[i]->handler = NULL;
if(gen != NULL && gen->type == SN_TYPE_FUNCTION) sn->local_variables[i]->handler = gen->handler;
sn->local_variables[i + 1] = NULL;