On Sat, Oct 26, 2024 at 02:29:29PM -0400, Peter Colberg wrote: > The issue may be worked around by simplifying the code, e.g., > > --- a/match.c > +++ b/match.c > @@ -1477,18 +1477,19 @@ matches_update_internal(struct matches *matches, bool > incremental) > > char32_t **new_tokens = reallocarray( > tokens, tok_count, sizeof(tokens[0])); > + > + if (new_tokens == NULL) { > + free(tokens);
This is missing free(tok_lengths). Peter > + free(copy); > + goto unlock_and_return; > + } > + > size_t *new_tok_lengths = reallocarray( > tok_lengths, tok_count, sizeof(tok_lengths[0])); > > - if (new_tokens == NULL || new_tok_lengths == NULL) { > - if (new_tokens != NULL) > - free(new_tokens); > - else > - free(tokens); > - if (new_tok_lengths != NULL) > - free(new_tok_lengths); > - else > - free(tok_lengths); > + if (new_tok_lengths == NULL) { > + free(tok_lengths); > + free(new_tokens); > free(copy); > goto unlock_and_return; > } > > ricci:~/git/debian.org/swaywm-team/fuzzel/obj-riscv64-linux-gnu% cc > -Ifuzzel.p -I. -I.. -I/usr/include/pixman-1 -I/usr/include/freetype2 > -I/usr/include/libpng16 -I/usr/include/cairo -I/usr/include/harfbuzz > -I/usr/include/glib-2.0 -I/usr/lib/riscv64-linux-gnu/glib-2.0/include > -I/usr/include/sysprof-6 -fdiagnostics-color=always -DNDEBUG > -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Werror -std=c18 -D_GNU_SOURCE > -fno-asynchronous-unwind-tables -DMEMFD_CREATE -fmacro-prefix-map=../= > -DFUZZEL_ENABLE_CAIRO=1 -DFUZZEL_ENABLE_PNG_LIBPNG=1 > -DFUZZEL_ENABLE_SVG_NANOSVG=1 -g -O2 -Werror=implicit-function-declaration > -ffile-prefix-map=/home/pcolberg/git/debian.org/swaywm-team/fuzzel=. > -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time > -D_FORTIFY_SOURCE=2 -pthread -DUTF8PROC_EXPORTS -MD -MQ fuzzel.p/match.c.o > -MF fuzzel.p/match.c.o.d -o fuzzel.p/match.c.o -c ../match.c > ricci:~/git/debian.org/swaywm-team/fuzzel/obj-riscv64-linux-gnu% gcc --version > gcc (Debian 14.2.0-7) 14.2.0 > Copyright (C) 2024 Free Software Foundation, Inc. > This is free software; see the source for copying conditions. There is NO > warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. > > Peter