aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSebastiano Tronto <sebastiano.tronto@gmail.com>2021-11-15 07:41:24 +0100
committerSebastiano Tronto <sebastiano.tronto@gmail.com>2021-11-15 07:41:24 +0100
commit44beaa88e54d60d5c576380534cf5ebb8dd44709 (patch)
tree65be441f1783a33facd721ddffb9346a5d98e04b /src
parent1a90075f672a442cafa35c1cccbb6cf026c3980e (diff)
downloadnissy-44beaa88e54d60d5c576380534cf5ebb8dd44709.tar.gz
nissy-44beaa88e54d60d5c576380534cf5ebb8dd44709.zip
Fixed used of uninitialized aux variable
Diffstat (limited to '')
-rw-r--r--src/utils.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/utils.c b/src/utils.c
index f72a00e..1c829c4 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -159,12 +159,16 @@ is_perm(int *a, int n)
159{ 159{
160 int *aux = malloc(n * sizeof(int)); 160 int *aux = malloc(n * sizeof(int));
161 int i; 161 int i;
162 162
163 for (i = 0; i < n; i++) 163 for (i = 0; i < n; i++)
164 aux[i] = 0;
165
166 for (i = 0; i < n; i++) {
164 if (a[i] < 0 || a[i] >= n) 167 if (a[i] < 0 || a[i] >= n)
165 return false; 168 return false;
166 else 169 else
167 aux[a[i]] = 1; 170 aux[a[i]] = 1;
171 }
168 172
169 for (i = 0; i < n; i++) 173 for (i = 0; i < n; i++)
170 if (!aux[i]) 174 if (!aux[i])

Generated with cgit - Back to sebastiano.tronto.net