delete_map() released the map's search node fields and the search struct
itself but not its strdup'd arg, exit_list and id members (allocated in
map_search_compile), leaking them each time a map is torn down or
replaced. Free them before freeing the search struct; free(NULL) is a
no-op for the members that were never set.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
history_get() clamped the requested index with URANGE(0, min,
root->used - 1); when the history list is empty (used == 0) the upper
bound is -1 and min became -1, so root->list[-1] was dereferenced.
Reject the command with an error when the history list is empty.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
scan_json() returned on a short/failed fread without freeing the src
buffer it had just allocated (the normal path frees it). Free src on
the error return.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
basetostring() and basetostringz() strdup'd a working buffer but, unlike
their encode counterparts stringtobase()/stringtobasez(), never freed it,
leaking one buffer per #format base decode. Free buf before returning,
matching the encode functions.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
strip_vt102_codes() called skip_vt102_codes() once in the loop
condition and again in the body to advance, so every escape sequence
was classified twice. It runs on every incoming line (and on the whole
output buffer), so cache the returned length and reuse it.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
regexp_compare() allocated and freed a pcre2_match_data block on every
match attempt, i.e. once per line per trigger/alias/highlight/substitute
on the hot input path. Allocate one shared match_data on first use and
reuse it; pcre2_match overwrites the ovector each call and the result is
copied straight into gtd->match, so no per-call allocation is needed.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
... as nothing is setting that flag on "ses":
$ git grep 'SET.*MOUSETRACKING'
src/config.c: SET_BIT(gtd->flags, TINTIN_FLAG_MOUSETRACKING);
src/config.c: SET_BIT(gtd->flags, TINTIN_FLAG_MOUSETRACKING);
src/config.c: SET_BIT(gtd->flags, TINTIN_FLAG_MOUSETRACKING);
src/config.c: SET_BIT(gtd->flags, TINTIN_FLAG_MOUSETRACKING);
With this change, connecting to a MUD which supports MTTS while having
done:
#config mouse on
... properly sets the bits for "MOUSE TRACKING" and "MSLP", as it
probably should.
Previous to this change, it couldn't - as that bit is never set on "ses"
so it reported that it couldn't do mouse tracking OR MSLP, despite being
perfectly able to (due to the `#config mouse on`, which the docs say is
the minimum prerequisite for MSLP support):
MSLP (Mud Server Link Protocol) requires enabling #config mouse on,
and creating the appropriate LINK events.
There are 4 ascii code attributes on the misplace line.
The first of these errors causes `#format %p' to not chomp off the CR correctly.
This fix has been verified to resolve the issue.