diff --git a/cjellyfish/damerau_levenshtein.c b/cjellyfish/damerau_levenshtein.c index 99ba1d4..c24e604 100644 --- a/cjellyfish/damerau_levenshtein.c +++ b/cjellyfish/damerau_levenshtein.c @@ -14,16 +14,14 @@ int damerau_levenshtein_distance(const char *s1, const char *s2) size_t d1, d2, d3, d4, result; unsigned short cost; - size_t *da = malloc(256 * sizeof(size_t)); + size_t *da = calloc(256, sizeof(size_t)); if (!da) { return -1; } - for(i = 0; i < 256; i++) { - da[i] = 0; - } size_t *dist = malloc((len1 + 2) * cols * sizeof(size_t)); if (!dist) { + free(da); return -1; }