Browse code

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.

John Hawthorn authored on 07/12/2024 06:16:45
Showing 1 changed files

... ...
@@ -187,7 +187,7 @@ score_t match_positions(const char *needle, const char *haystack, size_t *positi
187 187
 	M = malloc(sizeof(score_t) * MATCH_MAX_LEN * n);
188 188
 	D = malloc(sizeof(score_t) * MATCH_MAX_LEN * n);
189 189
 
190
-	score_t *last_D, *last_M;
190
+	score_t *last_D = NULL, *last_M = NULL;
191 191
 	score_t *curr_D, *curr_M;
192 192
 
193 193
 	for (int i = 0; i < n; i++) {