summaryrefslogtreecommitdiff
path: root/p11-kit
diff options
context:
space:
mode:
Diffstat (limited to 'p11-kit')
-rw-r--r--p11-kit/iter.c5
-rw-r--r--p11-kit/proxy.c10
2 files changed, 12 insertions, 3 deletions
diff --git a/p11-kit/iter.c b/p11-kit/iter.c
index 0e4ca6e..d1ffd91 100644
--- a/p11-kit/iter.c
+++ b/p11-kit/iter.c
@@ -157,7 +157,10 @@ p11_kit_iter_new (P11KitUri *uri,
return_val_if_fail (iter != NULL, NULL);
iter->modules = p11_array_new (NULL);
- return_val_if_fail (iter->modules != NULL, NULL);
+ if (iter->modules == NULL) {
+ p11_kit_iter_free (iter);
+ return_val_if_reached (NULL);
+ }
iter->want_writable = !!(behavior & P11_KIT_ITER_WANT_WRITABLE);
iter->preload_results = !(behavior & P11_KIT_ITER_BUSY_SESSIONS);
diff --git a/p11-kit/proxy.c b/p11-kit/proxy.c
index b7fb63d..abe7935 100644
--- a/p11-kit/proxy.c
+++ b/p11-kit/proxy.c
@@ -267,7 +267,10 @@ proxy_create (Proxy **res, CK_FUNCTION_LIST **loaded,
py->forkid = p11_forkid;
py->inited = modules_dup (loaded);
- return_val_if_fail (py->inited != NULL, CKR_HOST_MEMORY);
+ if (py->inited == NULL) {
+ proxy_free (py, 0);
+ return_val_if_reached (CKR_HOST_MEMORY);
+ }
rv = p11_kit_modules_initialize (py->inited, NULL);
@@ -320,7 +323,10 @@ proxy_create (Proxy **res, CK_FUNCTION_LIST **loaded,
}
py->sessions = p11_dict_new (p11_dict_ulongptr_hash, p11_dict_ulongptr_equal, NULL, free);
- return_val_if_fail (py->sessions != NULL, CKR_HOST_MEMORY);
+ if (py->sessions == NULL) {
+ proxy_free (py, 1);
+ return_val_if_reached (CKR_HOST_MEMORY);
+ }
py->refs = 1;
*res = py;