Branch: Tag:

2022-05-08

2022-05-08 21:43:11 by Tobias S. Josefowitz <tobij@tobij.de>

Compiler [Typechecker]: Fixed reference handling in store_marker()

In cases where the value passed to store_marker() was NULL but the
marker was present in the mapping, we used to overwrite the marker with
itself. By doing so, assign_svalue() (as used by low_mapping_insert())
would free the same value we were inserting. This is never great but has
especially noticeable consequences when the value only had a single
reference.

Instead, we now simply do not re-insert the value in these cases.

3960:    value = both = or_pike_types(old->u.type, value, 0);    }    SET_SVAL(val, T_TYPE, 0, type, value); -  } else if (!old) { +  } else if (!(old && TYPEOF(*old) == T_TYPE)) {    SET_SVAL(val, T_INT, NUMBER_NUMBER, integer, 0);    } else { -  val = *old; +  return;    }    mapping_insert(remap->markers[marker_set], &key, &val);    free_type(both);