summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas Mraz <tmraz@fedoraproject.org>2018-10-22 16:29:31 +0200
committerTomas Mraz <tmraz@fedoraproject.org>2018-10-22 16:29:31 +0200
commitfbf963dde2cbe34dba1df269b9506f4a55c39357 (patch)
tree4ff4382fb1755e03c4cb184b1dd83f98317a79d9
parentb692af1c13edb3b3900579d3c18ae1ad8f3cc85d (diff)
downloadlibpwquality-git-fbf963dde2cbe34dba1df269b9506f4a55c39357.tar.gz
Use calloc() instead of malloc() in distcalculate to initialize the memory.
-rw-r--r--src/check.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/check.c b/src/check.c
index ac7cbd5..61218a7 100644
--- a/src/check.c
+++ b/src/check.c
@@ -96,12 +96,12 @@ distance(const char *old, const char *new)
m = strlen(old);
n = strlen(new);
- distances = malloc(sizeof(int*) * (m + 1));
+ distances = calloc(m + 1, sizeof(int*));
if (distances == NULL)
return -1;
for (i = 0; i <= m; i++) {
- distances[i] = malloc(sizeof(int) * (n + 1));
+ distances[i] = calloc(n + 1, sizeof(int));
if (distances[i] == NULL)
goto allocfail;