From 37afd7aaa710bd45968db0d9387b6b750fe5cd63 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Sat, 23 Feb 2019 15:40:20 +0100 Subject: [PATCH] Fix memory leak --- kittens/choose/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kittens/choose/main.c b/kittens/choose/main.c index 0d83dc3d4..f84f1cb11 100644 --- a/kittens/choose/main.c +++ b/kittens/choose/main.c @@ -128,8 +128,9 @@ run_search(Options *opts, GlobalData *global, const char * const *lines, const s Chars chars = {0}; ALLOC_VEC(text_t, chars, 8192 * 20); + if (chars.data == NULL) return 1; ALLOC_VEC(Candidate, candidates, 8192); - if (chars.data == NULL || candidates.data == NULL) return 1; + if (candidates.data == NULL) { FREE_VEC(candidates) return 1; } for (size_t i = 0; i < num_lines; i++) { sz = sizes[i];