summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@thewalter.net>2014-08-08 17:40:57 +0200
committerStef Walter <stef@thewalter.net>2014-08-08 18:44:51 +0200
commitd9df354fffbbfa42aac796235cf446c63ad2eef8 (patch)
treecd2fa2fc3e0169cf38583f608ce8b45e8c28269f
parent3748527ed4deb980a2aa0a74893ccb4384951015 (diff)
trust: Double check that index bucket is valid before access
-rw-r--r--trust/index.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/trust/index.c b/trust/index.c
index 9a193c5..f4b6b4b 100644
--- a/trust/index.c
+++ b/trust/index.c
@@ -264,9 +264,9 @@ bucket_insert (index_bucket *bucket,
alloc = alloc ? alloc * 2 : 1;
return_if_fail (alloc != 0);
bucket->elem = realloc (bucket->elem, alloc * sizeof (CK_OBJECT_HANDLE));
- return_if_fail (bucket->elem != NULL);
}
+ return_if_fail (bucket->elem != NULL);
memmove (bucket->elem + at + 1, bucket->elem + at,
(bucket->num - at) * sizeof (CK_OBJECT_HANDLE));
bucket->elem[at] = handle;
@@ -284,9 +284,9 @@ bucket_push (index_bucket *bucket,
alloc = alloc ? alloc * 2 : 1;
return_val_if_fail (alloc != 0, false);
bucket->elem = realloc (bucket->elem, alloc * sizeof (CK_OBJECT_HANDLE));
- return_val_if_fail (bucket->elem != NULL, false);
}
+ return_val_if_fail (bucket->elem != NULL, false);
bucket->elem[bucket->num++] = handle;
return true;
}