diff --git a/Makefile b/Makefile index 92d8a54..d50cbac 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ PREFIX= CC=gcc CFLAGS=-O0 -std=gnu99 -D_XOPEN_SOURCE=500 -D_GNU_SOURCE -D_POSIX_C_SOURCE=200809L \ - -Wall -Wpedantic -Wno-unknown-pragmas -fsanitize=address -fno-omit-frame-pointer + -Wall -Wpedantic -Wno-unknown-pragmas UNAME := $(shell uname) ifeq ($(UNAME),Darwin) CFLAGS += -D_DARWIN_C_SOURCE -Weverything -Wno-missing-field-initializers -Wno-padded\ diff --git a/ask.c b/ask.c index 7ea4de5..1c4fb4f 100644 --- a/ask.c +++ b/ask.c @@ -121,6 +121,7 @@ static int draw_line(FILE *out, const char *line, const char *patt, int cursor) } } if (backtrack) fprintf(out, "\033[0m\033[%dD", backtrack); + free(cache); return to_start; } @@ -292,6 +293,7 @@ static char *get_input(FILE *in, FILE *out, const char *prompt, const char *init if (backtrack || prompt[0]) fprintf(out, "\033[%dD", backtrack + (int)strlen(prompt)); fputs("\033[0m\033[K", out); + if (picked != buf && buf) free(buf); return picked; }