From b2389a67fcd4102370ec600418be0743944be3b2 Mon Sep 17 00:00:00 2001 From: John Hawthorn Date: Fri, 6 Dec 2024 22:16:45 -0800 Subject: [PATCH] Initialize avoid uninitialized variable warning These pointers were never dereferenced in their uninitialized form, as that only happens for i > 0, but we should do this to avoid the compiler warning. --- src/match.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/match.c b/src/match.c index d618f0a..fa59d4d 100644 --- a/src/match.c +++ b/src/match.c @@ -187,7 +187,7 @@ score_t match_positions(const char *needle, const char *haystack, size_t *positi M = malloc(sizeof(score_t) * MATCH_MAX_LEN * n); D = malloc(sizeof(score_t) * MATCH_MAX_LEN * n); - score_t *last_D, *last_M; + score_t *last_D = NULL, *last_M = NULL; score_t *curr_D, *curr_M; for (int i = 0; i < n; i++) {