summaryrefslogtreecommitdiff
path: root/security/trousers/files/patch-src_tspi_rpc_hosttable.c
blob: 23d8c10488d6579db46c034c2a1f82a48f0d746a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
--- src/tspi/rpc/hosttable.c.orig	2016-11-19 03:09:49 UTC
+++ src/tspi/rpc/hosttable.c
@@ -51,6 +51,8 @@ host_table_final()
 {
 	struct host_table_entry *hte, *next = NULL;
 
+	if( ht == NULL ) return;
+
 	MUTEX_LOCK(ht->lock);
 
 	for (hte = ht->entries; hte; hte = next) {
@@ -85,6 +87,8 @@ __tspi_add_table_entry(TSS_HCONTEXT tspC
     struct host_table_entry *entry, *tmp;
     int hostlen;
 
+    if( ht == NULL ) return TSPERR(TSS_E_OUTOFMEMORY);
+
     entry = calloc(1, sizeof(struct host_table_entry));
     if (entry == NULL) {
             LogError("malloc of %zd bytes failed.", sizeof(struct host_table_entry));
@@ -144,6 +148,8 @@ remove_table_entry(TSS_HCONTEXT tspConte
 {
 	struct host_table_entry *hte, *prev = NULL;
 
+	if( ht == NULL ) return;
+
 	MUTEX_LOCK(ht->lock);
 
 	for (hte = ht->entries; hte; prev = hte, hte = hte->next) {
@@ -168,6 +174,8 @@ get_table_entry(TSS_HCONTEXT tspContext)
 {
 	struct host_table_entry *index = NULL;
 
+	if( ht == NULL ) return NULL;
+
 	MUTEX_LOCK(ht->lock);
 
 	for (index = ht->entries; index; index = index->next) {